From 53f33221b77d0afc43dff16e355f2f991cbe9c11 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Mon, 14 Jun 2021 10:35:27 -0400 Subject: [PATCH] Fix adapter-node build in presence of tsconfig.json (#1675) * 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. * add changeset --- .changeset/wild-pumas-jam.md | 5 +++++ packages/adapter-node/index.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) 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 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');