Skip to content

Commit 17513da

Browse files
fix(svelte-scoped): replace build hook with buildEnd to remove setAss… (#5159)
1 parent f59f096 commit 17513da

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

packages-integrations/svelte-scoped/src/_vite/globalStylesPlugin.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,18 @@ export function GlobalStylesPlugin(ctx: SvelteScopedContext, injectReset?: Unocs
5050
}
5151
},
5252

53-
// build
54-
async buildStart() {
53+
// build end - runs after all module transforms complete, so on-demand theme tokens are fully tracked
54+
async buildEnd() {
5555
if (viteConfig.command === 'build') {
56+
const css = await generateGlobalCss(ctx.uno, injectReset)
5657
unoCssFileReferenceId = this.emitFile({
5758
type: 'asset',
5859
name: GLOBAL_STYLES_CSS_FILE_NAME,
60+
source: css,
5961
})
6062
}
6163
},
6264

63-
// build - runs after all module transforms complete, so on-demand theme tokens are fully tracked
64-
async buildEnd() {
65-
if (viteConfig.command === 'build') {
66-
const css = await generateGlobalCss(ctx.uno, injectReset)
67-
this.setAssetSource(unoCssFileReferenceId, css)
68-
}
69-
},
70-
7165
// build
7266
renderStart() {
7367
unoCssGlobalFileName = this.getFileName(unoCssFileReferenceId)

0 commit comments

Comments
 (0)