Hi everyone,
When I run “sls deploy --stage prod”, I got error: ‘import’ and ‘export’ may appear only with ‘sourceType: module’.
My application built with NestJS, here my tsconfig.json:
{
"compilerOptions": {
"module": "CommonJS",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false,
}
}
My function in serverless:
functions:
agent:
handler: dist/handlerApi/agent/lambda.handler
events:
- http:
method: any
path: /api-agent/{proxy+}
It work fine when run “sls offline”. Thanks for helping me!