-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Co-authored-by: @akash1810
Given a CDK project with a CI script that looks like this
npm ci
npm run build
npm run lint
npm run test
npm run synth
When running the build script in CDK using the existing default tsconfig, npm run build fails with the following error: error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later.
We modified the tsconfig, from "module": "CommonJS", "module": "ESNext", as recommended, and reran the script. In that case, the synth step fails: TypeError: Unknown file extension ".ts" for /<REPO>/cdk/bin/cdk.ts
We were able to get the CI script to pass by switching back to CommonJS, ignoring the VSCode error, and removing the build step from the CI script. We're not entirely sure why we need a build step, as long as it synths correctly, that should be enough. Could we remove it from future CDK project setups?
The default configuration also produces compiled .js files that failed the lint. The default tsconfig should include a noEmit option.