Skip to content

Commit abed929

Browse files
fix: sync override settings (#14782)
1 parent 0bcc9f6 commit abed929

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

.changeset/tender-wasps-shop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Improves syncing

packages/astro/src/assets/fonts/vite-plugin-fonts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ interface Options {
6767
}
6868

6969
export function fontsPlugin({ settings, sync, logger }: Options): Plugin {
70-
if (sync || !settings.config.experimental.fonts) {
70+
if (!settings.config.experimental.fonts) {
7171
// This is required because the virtual module may be imported as
7272
// a side effect
7373
// TODO: remove once fonts are stabilized
@@ -319,7 +319,7 @@ export function fontsPlugin({ settings, sync, logger }: Options): Plugin {
319319
}
320320
},
321321
async buildEnd() {
322-
if (settings.config.experimental.fonts!.length === 0) {
322+
if (sync || settings.config.experimental.fonts!.length === 0) {
323323
cleanup();
324324
return;
325325
}

packages/astro/src/core/sync/index.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,26 @@ async function syncContentCollections(
251251
ssr: { external: [] },
252252
logLevel: 'silent',
253253
},
254-
{ settings, logger, mode, command: 'build', fs, sync: true, routesList, manifest },
254+
{
255+
// Prevent mutation of specific properties by vite plugins during sync
256+
settings: {
257+
...settings,
258+
// Prevent mutation by vite plugins during sync
259+
buildOutput: undefined,
260+
// Sync causes font resources and style hashes to be duplicated
261+
injectedCsp: {
262+
fontResources: new Set(),
263+
styleHashes: [],
264+
},
265+
},
266+
logger,
267+
mode,
268+
command: 'build',
269+
fs,
270+
sync: true,
271+
routesList,
272+
manifest,
273+
},
255274
),
256275
);
257276

0 commit comments

Comments
 (0)