3 ms·
About module resolution, you are looking for "paths" compiler option : https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping https:/
by srgpqt 8y ago
About module resolution, you are looking for "paths" compiler option :
https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping https://www.typescriptlang.org/docs/handbook/module-resoluti...
- jacobwg 8y agoThe "paths" compiler option only instructs TypeScript where to find files for resolution, but doesn't automatically rewrite those path aliases to their correct locations after build. There are plugins for JS bundlers like Webpack and Rollup so that they too can understand the path aliases, but if you're just looking to run the build JavaScript with vanilla Node, I've found the following two projects useful: - https://github.com/dividab/tsconfig-paths https://github.com/dividab/tsconfig-paths - resolves paths aliases at runtime in Node - https://github.com/duffman/tspath https://github.com/duffman/tspath - run after build, it rewrites the imports in the resulting JavaScript files