Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Not able to import as absolute path #250

Open
mayank-kansal15 opened this issue Nov 13, 2019 · 3 comments
Open

Not able to import as absolute path #250

mayank-kansal15 opened this issue Nov 13, 2019 · 3 comments

Comments

@mayank-kansal15
Copy link

I am not able to import modules with an absolute path. My baseUrl and absolute path are correctly set. When I searched a bit about the issue it seems like it is because of moduleResolution as "node" when I set as "classic" absolute import works.

@peterblazejewicz
Copy link
Collaborator

hey,
instead of falling back to older module resolution have you tried to work with your project tsconfigs details and use for example path aliases:
https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping
https://github.com/microsoft/TypeScript-Node-Starter/blob/master/tsconfig.json#L12-L16
?

@mayank-kansal15
Copy link
Author

@peterblazejewicz Appreciate the quick response, I will check these and get back.

@mayank-kansal15
Copy link
Author

@peterblazejewicz Went through both the above links and tried some combination by changing path and base URL but no success. Can you please help me here and tell what change should I do in tsconfig.json and/or in package.json so that absolute URL works both in VSCode and from the command like "npm run server".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants