hello, I'm trying to update to nestjs 10 and i want to use swc compiler, but when I'm building my docker container, i get error:
(same happens when i just run "yarn start:dev" -> nest start --watch -b swc)
my-app | Error: Cannot find module './#AppModule'
my-app | Require stack:
my-app | - /app/apps/my-app/dist/main.js
my-app | at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)....
I found that when i change import from #AppModule to ./AppModule, error fixes, and i get different error that is related to # alias too, like example it cannot find module "#Utils" (where i import logger from Utils folder index.ts), there is my configs:
.swcrc:
{
"$schema": "https://json.schemastore.org/swcrc",
"module": {
"type": "commonjs"
},
"jsc": {
"target": "es2017",
"parser": {
"syntax": "typescript"
},
"baseUrl": "./",
"paths": {
"#*": ["src/*"]
}
},
"minify": false
}
tsconfig.json:
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"isolatedModules": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"paths": {
"#*": ["src/*"]
},
"incremental": true,
"resolveJsonModule": true,
"skipLibCheck": true
},
"exclude": ["node_modules", "dist", "jest*.ts"],
"include": ["src/**/*"]
}
nest-cli.json:
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"builder": "swc",
"typeCheck": true
}
}
And I have noticed that before using swc compiler, my dist was: my-app/dist/src/(my-app-files) and now my-app/dist/(my-app-files), maybe this could be related to the issue that I'm countering? And how to solve it?