Skip to content

Commit

Permalink
Update packages/kit/src/exports/vite/index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm authored Dec 16, 2024
1 parent 8b24a70 commit df52a4e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/kit/src/exports/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>} */
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} */
Expand Down

0 comments on commit df52a4e

Please sign in to comment.