From df52a4eed06395b62934933e8ab7d620df957e30 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:32:04 +0100 Subject: [PATCH] Update packages/kit/src/exports/vite/index.js --- packages/kit/src/exports/vite/index.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/kit/src/exports/vite/index.js b/packages/kit/src/exports/vite/index.js index 419e507dd37e..8a52c04d1feb 100644 --- a/packages/kit/src/exports/vite/index.js +++ b/packages/kit/src/exports/vite/index.js @@ -817,20 +817,19 @@ async function kit({ svelte_config }) { // we do not want to copy the unused server stylesheets generated by // Vite's `build.ssrEmitAssets` option - /** @type {string[]} */ - const ssr_stylesheets = []; + /** @type {Set} */ + const ssr_stylesheets = new Set(); for (const key in server_manifest) { - const stylesheets = server_manifest[key].css; - if (stylesheets) { - ssr_stylesheets.push(...stylesheets); + const stylesheets = server_manifest[key].css ?? []; + for (const stylesheet of stylesheets) { + ssr_stylesheets.add(stylesheet); } } - const ssr_stylesheets_set = new Set(ssr_stylesheets); const assets_path = `${kit.appDir}/immutable/assets`; copy(`${out}/server/${assets_path}`, `${out}/client/${assets_path}`, { - filter: (basename) => !ssr_stylesheets_set.has(`${assets_path}/${basename}`) + filter: (basename) => !ssr_stylesheets.has(`${assets_path}/${basename}`) }); /** @type {import('vite').Manifest} */