I have the following config with paths:
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"paths": {
"@/*": ["./src/*"]
},
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
And I'm running the following node command: node --require tsconfig-paths/register --require reflect-metadata --enable-source-maps dist/web/src/server/web.js\"
But it's failing with the following error:
Error: Cannot find module '@/server/services/UsersService'
Require stack:
- /workspace/dist/web/src/server/workers/ExampleWorker.js
- /workspace/dist/web/src/server/web.js
at Function.<anonymous> (node:internal/modules/cjs/loader:1249:15)
at Function.Module._resolveFilename (/workspace/node_modules/tsconfig-paths/src/register.ts:115:36)
at <anonymous> (/workspace/node_modules/next/src/server/require-hook.ts:51:34)
at Function._load (node:internal/modules/cjs/loader:1075:27)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
at Module.<anonymous> (node:internal/modules/cjs/loader:1340:12)
at Module.patchedRequire (/workspace/node_modules/require-in-the-middle/index.js:223:34)
at Hook._require.Module.require (/workspace/node_modules/require-in-the-middle/index.js:171:27)
at Module.mod.require (/workspace/node_modules/next/src/server/require-hook.ts:70:26) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/workspace/dist/web/src/server/workers/ExampleWorker.js',
'/workspace/dist/web/src/server/web.js'
]
}
You can see that tsconfig-paths is part of the callstack but the path is not replaced. Any ideas on how to fix?
I have the following config with paths:
{ "compilerOptions": { "target": "ES2017", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", "incremental": true, "paths": { "@/*": ["./src/*"] }, "experimentalDecorators": true, "emitDecoratorMetadata": true }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "exclude": ["node_modules"] }And I'm running the following node command:
node --require tsconfig-paths/register --require reflect-metadata --enable-source-maps dist/web/src/server/web.js\"But it's failing with the following error:
You can see that tsconfig-paths is part of the callstack but the path is not replaced. Any ideas on how to fix?