I'm switching from relative path import to absolute path import for my CDK package, and get this error when run cdk synth
:
$ cdk synth
Error: Cannot find module 'lib/CodePipelineStack'
I followed this using absolute paths in typescript for imports to setup the baseUrl
and paths
in tsconfig.json
file.
Not sure why it is not working.
More context
My project structure looks like this:
My tsconfig.json is:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"bin/*": [ "./bin/*" ],
"lib/*": [ "./lib/*" ],
"test/*": [ "./test/*" ]
},
"target": "ES2018",
"module": "commonjs",
"lib": [
"es2018"
],
"declaration": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": false,
"inlineSourceMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"typeRoots": [
"./node_modules/@types"
]
},
"exclude": [
"node_modules",
"cdk.out"
]
}
I tried "baseUrl": "./"
and "baseUrl": "."
, both are not working.