TypeScript-Node-Starter
TypeScript-Node-Starter copied to clipboard
Not able to import as absolute path
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.
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
?
@peterblazejewicz Appreciate the quick response, I will check these and get back.
@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".