Skip to content

Commit e444375

Browse files
lsdsjysapphi-red
andauthored
fix(legacy): style insert order (#13266)
Co-authored-by: sapphi-red <[email protected]>
1 parent 19e8c68 commit e444375

File tree

1 file changed

+3
-3
lines changed
  • packages/vite/src/node/plugins

1 file changed

+3
-3
lines changed

packages/vite/src/node/plugins/css.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -636,10 +636,10 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
636636
`${style}.textContent = ${cssString};` +
637637
`document.head.appendChild(${style});`
638638
const wrapIdx = code.indexOf('System.register')
639-
const insertMark = "'use strict';"
640-
const insertIdx = code.indexOf(insertMark, wrapIdx)
639+
const executeFnStart =
640+
code.indexOf('{', code.indexOf('execute:', wrapIdx)) + 1
641641
const s = new MagicString(code)
642-
s.appendLeft(insertIdx + insertMark.length, injectCode)
642+
s.appendRight(executeFnStart, injectCode)
643643
if (config.build.sourcemap) {
644644
// resolve public URL from CSS paths, we need to use absolute paths
645645
return {

0 commit comments

Comments
 (0)