-3
rated 0 times
[
4]
[
7]
/ answers: 1 / hits: 7211
/ 4 Years ago, thu, june 18, 2020, 12:00:00
I'm trying to run a typescript project in production mode. The code is here on Github
- Running
npm run start:dev
is running the server up on http://localhost:3000/ - Running
npm run build
is generating thedist
folder
The package.json
has the definition of @server
defined using module alias:
_moduleAliases: {
@server: dist/Server
}
The @server
is defined under compilerOptions.paths.@server
in tsconfig.json
too!
The index.ts
imports app
from @server
;
import app from '@server';
When I run npm start
- it does nothing
So I tried node dist/index.js --env=production
and it throws the following error:
Error: Cannot find module '@server'
Why is the node not detecting this module alias?
More From » node.js