From 1f8625373b8b382e557f27e40bf0bbc5b33f84dd Mon Sep 17 00:00:00 2001 From: Conduitry Date: Fri, 11 Jun 2021 12:09:18 -0400 Subject: [PATCH 1/2] target Node 12 in app output Without an explicit target value, esbuild will pick up the version from tsconfig.json, if present. This breaks the build if that specifies a target of es2019, which does not support import.meta. --- packages/adapter-node/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/adapter-node/index.js b/packages/adapter-node/index.js index 9ac22d0b0eca..5643b87b3dce 100644 --- a/packages/adapter-node/index.js +++ b/packages/adapter-node/index.js @@ -28,7 +28,8 @@ export default function ({ out = 'build' } = {}) { bundle: true, external: Object.keys(JSON.parse(readFileSync('package.json', 'utf8')).dependencies || {}), format: 'esm', - platform: 'node' + platform: 'node', + target: 'node12' }); utils.log.minor('Prerendering static pages'); From 71e701f1f67514da6174d9af592650c88c3f6cf5 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Fri, 11 Jun 2021 12:09:57 -0400 Subject: [PATCH 2/2] add changeset --- .changeset/wild-pumas-jam.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/wild-pumas-jam.md diff --git a/.changeset/wild-pumas-jam.md b/.changeset/wild-pumas-jam.md new file mode 100644 index 000000000000..f687c21617b7 --- /dev/null +++ b/.changeset/wild-pumas-jam.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/adapter-node': patch +--- + +Fix build when using TypeScript and there is a `tsconfig.json` with `target: 'es2019'` or earlier