From 36dc54ac740b8b4c6a2b904a1d0aadd8923a875c Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:51:42 -0800 Subject: [PATCH] fix: respect `build.target` config supplied by user (#11688) --- .changeset/fluffy-insects-build.md | 5 +++++ .../docs/60-appendix/30-migrating-to-sveltekit-2.md | 2 -- packages/kit/src/exports/vite/index.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .changeset/fluffy-insects-build.md diff --git a/.changeset/fluffy-insects-build.md b/.changeset/fluffy-insects-build.md new file mode 100644 index 000000000000..6ff2b7c8b742 --- /dev/null +++ b/.changeset/fluffy-insects-build.md @@ -0,0 +1,5 @@ +--- +"@sveltejs/kit": patch +--- + +fix: use Vite's default value for `build.target` and respect override supplied by user diff --git a/documentation/docs/60-appendix/30-migrating-to-sveltekit-2.md b/documentation/docs/60-appendix/30-migrating-to-sveltekit-2.md index d5eedbb281fc..31d126dd84e6 100644 --- a/documentation/docs/60-appendix/30-migrating-to-sveltekit-2.md +++ b/documentation/docs/60-appendix/30-migrating-to-sveltekit-2.md @@ -161,5 +161,3 @@ SvelteKit 2 requires Node `18.13` or higher, and the following minimum dependenc `svelte-migrate` will update your `package.json` for you. As part of the TypeScript upgrade, the generated `tsconfig.json` (the one your `tsconfig.json` extends from) now uses `"moduleResolution": "bundler"` (which is recommended by the TypeScript team, as it properly resolves types from packages with an `exports` map in package.json) and `verbatimModuleSyntax` (which replaces the existing `importsNotUsedAsValues ` and `preserveValueImports` flags — if you have those in your `tsconfig.json`, remove them. `svelte-migrate` will do this for you). - -SvelteKit 2 uses ES2022 features, which are supported in all modern browsers. diff --git a/packages/kit/src/exports/vite/index.js b/packages/kit/src/exports/vite/index.js index 7c8297faf3be..94d511ab86e7 100644 --- a/packages/kit/src/exports/vite/index.js +++ b/packages/kit/src/exports/vite/index.js @@ -645,7 +645,7 @@ async function kit({ svelte_config }) { preserveEntrySignatures: 'strict' }, ssrEmitAssets: true, - target: ssr ? 'node18.13' : 'es2022' + target: ssr ? 'node18.13' : undefined }, publicDir: kit.files.assets, worker: {