question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:open
  • Created 5 years ago
  • Reactions:23
  • Comments:30

github_iconTop GitHub Comments

107reactions
dotansimhacommented, Oct 26, 2018

As a workaround, you can do node -r ts-node/register -r tsconfig-paths/register dist/index.js. @kel-sakal-biyik @darkbasic

59reactions
sandangelcommented, Mar 20, 2019

May I ask for an update on this issue?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found