tsconfig-paths doesn't work with node (works with ts-node)
See original GitHub issue$ node -r tsconfig-paths/register dist/index.js
module.js:550
throw err;
^
Error: Cannot find module '@modules/webhooks'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._resolveFilename (/home/niko/WebstormProjects/guild-review/node_modules/tsconfig-paths/lib/register.js:73:40)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/niko/WebstormProjects/guild-review/server/dist/index.js:5:20)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
Repro: https://github.com/darkbasic/guild-review
yarn && yarn workspace server build && cd server && node -r tsconfig-paths/register dist/index.js
Issue Analytics
- State:
- Created 5 years ago
- Reactions:23
- Comments:30
Top Results From Across the Web
nodemon - Typescript paths not working in an Express project
Perfect, we will execute node with -r tsconfig-paths/register to convert paths into physical file paths and -r ts-node/register to execute ...
Read more >Typescript paths with ts-node, ts-node-dev and Jest | Medium
To solve this problem we will use tsconfig-paths, a package that takes the baseUrl and paths options and does exactly what we want:...
Read more >tsconfig-paths - npm
Use this to load modules whose location is specified in the paths section of tsconfig.json or jsconfig.json . Both loading at run-time and...
Read more >paths and baseUrl | ts-node - TypeStrong · GitHub
You can use ts-node together with tsconfig-paths to load modules according to the paths section in tsconfig.json.
Read more >TSConfig Reference - Docs on every TSConfig option
When enabled, TypeScript will check all code paths in a function to ensure they ... When working with .d.ts files for JavaScript files...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a workaround, you can do
node -r ts-node/register -r tsconfig-paths/register dist/index.js
. @kel-sakal-biyik @darkbasicMay I ask for an update on this issue?