I have Nest.js
app with configured launch.json
and when I start debugging, it fails with error saying that it can't find module, when import path starts with 'src/'
, for example:
This will fail with the error Error: Cannot find module 'src/user/module'
:
import { UserModule } from 'src/user/user.module';
@Module({
imports: [
...
UserModule,
]
})
export class AppModule {}
This will work:
import { UserModule } from './user/user.module';
@Module({
imports: [
...
UserModule,
]
})
export class AppModule {}
Here's my launch.json
:
{
"version": "0.2.0",
"configureOptions": [
{
"type": "node",
"request": "launch",
"name": "Debug Nest",
"args": ["${workspaceFolder}/src/main.ts"],
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "externalTerminal"
}
]
}
Any ideas?