I have already added these paths to tsconfig.json
:
{
"compilerOptions": {
"lib": ["ESNext"],
"moduleResolution": "node",
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": true,
"sourceMap": true,
"target": "ES2020",
"outDir": "lib",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"baseUrl": ".",
"paths": {
"@lambdas/*": ["src/lambdas/*"],
"@services/*": ["src/services/*"],
"@types/*": ["src/@types/*"],
"@configs/*": ["src/configs/*"],
"@database/*": ["src/database/*"],
"@entities/*": ["src/entities/*"],
"@validations/*": ["src/validations/*"],
"#serverless/*": ["serverless/*"]
}
},
"include": ["src/**/*.ts", "serverless.ts"],
"exclude": [
"node_modules/**/*",
".serverless/**/*",
".webpack/**/*",
"_warmup/**/*",
".vscode/**/*"
]
}
And in the jest.config.js
I added this:
const { pathsToModuleNameMapper } = require('ts-jest/utils');
// eslint-disable-next-line import/extensions
const { compilerOptions } = require('./tsconfig.json');
// module.exports = { ...
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
// ...
But I still have the same behaviour: the intellisense doesn't even load the possible custom paths like those listed above as you can see in the image below:
That happens with this folder structure:
You can create a new tsconfig file just for building. ex: copy your current
tsconfig.json
totsconfig.build.json
Remember to update esbuild options in
serverless.ts
then create a new
tsconfig.json
for IDE(vscode) and test: