You can use: npmjs.com/package/tsconfig-paths
it much easier
Thank you so much! I've probably spent like 6 hours in total trying to get this to work and I finally see the listening on port 3000 log 😁
listening on port 3000
I also kept receiving module_not_found while running ts-node. The way that worked for me (taken from stackoverflow.com/questions/566507...
In tsconfig.json add the following section:
tsconfig.json
"ts-node": { "require": ["tsconfig-paths/register"] },
In order to make the script run on the compiled js (for production distribution), you can defined the following script in package.json:
package.json
"scripts": { "start": "TS_NODE_BASEURL=./dist node -r tsconfig-paths/register dist/index.js" }
Don't forget to run npm i tsconfig-paths
npm i tsconfig-paths
you made my day, thx!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can use:
npmjs.com/package/tsconfig-paths
it much easier
Thank you so much! I've probably spent like 6 hours in total trying to get this to work and I finally see the
listening on port 3000
log 😁I also kept receiving module_not_found while running ts-node.
The way that worked for me (taken from stackoverflow.com/questions/566507...
In
tsconfig.json
add the following section:In order to make the script run on the compiled js (for production distribution), you can defined the following script in
package.json
:Don't forget to run
npm i tsconfig-paths
you made my day, thx!