-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't make paths work properly #19453
Comments
TypeScript won't rewrite your import filenames - you need to write import declarations that would work at runtime. |
I don't understand your response, how can I use absolute imports in my example? I tried to follow documentation: Reading this documentation, I thought my example should run but it doesn't. |
|
OK, but how can I make typescript generate javascript code that can be executed with absolute path imports? I don't want to write I would prefer to use absolute path as core directory is a root directory of my app. I understood paths tsconfig property is here to resolve absolute paths and it works, it makes the build work properly. But the generated javascript is not working. |
That would be a new feature that we do not support today. feel free to create a new issue for this request. |
I don't understand, when I read the documentation: In the paragraph:
It seems to correspond to my use case, doesn't? |
From the text you quoted, emphasis added:
|
Thank you mhegazy, Now I understand why the sample I created is not working properly. As you suggested I will open a new issue to ask for absolute path imports to avoid imports like ../../../xxx Regards, |
Hello,
I'm trying to use paths property in my tsconfig.json file.
It makes the build work perfectly but execution of generated js is failing.
My tsconfig.json:
src/core/service.ts:
src/core/index.ts:
src/index.ts:
The build is working perfectly
But running dist\index.js I obtain:
Error: Cannot find module 'core'
Am I doing something wrong?
I made a repo to illustrate this:
https://github.com/BUONJG/typescript-paths.git
Many thanks for your support,
Jean-Guy
The text was updated successfully, but these errors were encountered: