tsconfig-paths has stuck when run with ts-node with tsconfig.json
nhatdn opened this issue · comments
old configs
{
"compilerOptions": {
"sourceMap": true,
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"moduleResolution": "Node",
"outDir": "./dist",
"alwaysStrict": true,
"noImplicitAny": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"strict": true,
"module": "ESNext",
"target": "es5",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"rootDirs": ["src"],
"types": ["node", "jest", "express"]
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"],
"ts-node": {
"experimentalSpecifierResolution": "node",
"transpileOnly": true,
"esm": true,
"require": ["tsconfig-paths/register"]
},
}
This is a solution (install tsnode latest) and config tsconfig.json file:
{
"compilerOptions": {
"sourceMap": true,
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"moduleResolution": "NodeNext",
"outDir": "dist",
"alwaysStrict": true,
"noImplicitAny": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"strict": true,
"module": "NodeNext",
"target": "ES2022",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"rootDirs": ["src"],
"types": ["node", "jest", "express"]
},
"include": ["src/**/*"],
"exclude": ["node_modules"],
"ts-node": {
"experimentalSpecifierResolution": "node",
"transpileOnly": true,
"esm": false,
"require": ["tsconfig-paths/register"]
},
}
refer: Van Bao developer