Skip to content

Commit

Permalink
fix: @jsii/check-node crashes on loading with older node releases
Browse files Browse the repository at this point in the history
It was built with ES2020 target, which fails to load with Node 10 and 12 as
it makes use of the ?? syntax, which is not available in those releases.
Changing the TypeScript target so that code continues to load in older node
releases.
  • Loading branch information
RomainMuller committed Jun 9, 2022
1 parent de3fc03 commit 839386c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 0 additions & 2 deletions packages/@jsii/check-node/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export class NodeRelease {
// Past end-of-life releases
new NodeRelease(13, { endOfLife: new Date('2020-06-01') }),
new NodeRelease(15, { endOfLife: new Date('2021-06-01') }),

// Deprecated releases
new NodeRelease(12, {
endOfLife: new Date('2022-04-30'),
supportedRange: '^12.7.0',
Expand Down
9 changes: 7 additions & 2 deletions packages/@jsii/check-node/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"extends": "../../../tsconfig-base",
"compilerOptions": {
"target": "es2018", // Needs to target older releases of node or else it'll crash on start when using those
"outDir": "./lib",
"rootDir": "./src",
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts"],
"include": [
"src/**/*.ts"
],
"exclude": [
"jest.config.ts"
],
}
2 changes: 1 addition & 1 deletion packages/@jsii/runtime/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
iife: false,
},
devtool: 'source-map',
target: 'node14.5',
target: 'node12', // Continue to target node 12 so that check-node does not fail to load on it.
node: {
global: false,
__filename: false,
Expand Down

0 comments on commit 839386c

Please sign in to comment.