Skip to content

Commit

Permalink
fix: client build minification (#9012)
Browse files Browse the repository at this point in the history
* fix minification

* changeset

* fewer moving parts
  • Loading branch information
gtm-nayan committed Feb 12, 2023
1 parent 98226de commit 74cfa8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/eleven-buckets-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: ssr defaults preventing minification for client build
6 changes: 5 additions & 1 deletion packages/kit/src/exports/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ function kit({ svelte_config }) {
/** @type {() => Promise<void>} */
let finalise;

/** @type {import('vite').UserConfig} */
let initial_config;

const service_worker_entry_file = resolve_entry(kit.files.serviceWorker);

/** @type {import('vite').Plugin} */
Expand All @@ -190,6 +193,7 @@ function kit({ svelte_config }) {
* @see https://vitejs.dev/guide/api-plugin.html#config
*/
async config(config, config_env) {
initial_config = config;
vite_config_env = config_env;
is_build = config_env.command === 'build';

Expand Down Expand Up @@ -634,7 +638,7 @@ export function set_assets(path) {
logLevel: vite_config.logLevel,
clearScreen: vite_config.clearScreen,
build: {
minify: vite_config.build.minify,
minify: initial_config.build?.minify,
assetsInlineLimit: vite_config.build.assetsInlineLimit,
sourcemap: vite_config.build.sourcemap
},
Expand Down

0 comments on commit 74cfa8d

Please sign in to comment.