Skip to content

Commit

Permalink
Fix adapter-node build in presence of tsconfig.json (#1675)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Conduitry authored Jun 14, 2021
1 parent 9a7195b commit 53f3322
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/wild-pumas-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-node': patch
---

Fix build when using TypeScript and there is a `tsconfig.json` with `target: 'es2019'` or earlier
3 changes: 2 additions & 1 deletion packages/adapter-node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 53f3322

Please sign in to comment.