Skip to content

Commit

Permalink
fix(legacy): style insert order (#13266)
Browse files Browse the repository at this point in the history
Co-authored-by: sapphi-red <[email protected]>
  • Loading branch information
lsdsjy and sapphi-red authored May 22, 2023
1 parent 19e8c68 commit e444375
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,10 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
`${style}.textContent = ${cssString};` +
`document.head.appendChild(${style});`
const wrapIdx = code.indexOf('System.register')
const insertMark = "'use strict';"
const insertIdx = code.indexOf(insertMark, wrapIdx)
const executeFnStart =
code.indexOf('{', code.indexOf('execute:', wrapIdx)) + 1
const s = new MagicString(code)
s.appendLeft(insertIdx + insertMark.length, injectCode)
s.appendRight(executeFnStart, injectCode)
if (config.build.sourcemap) {
// resolve public URL from CSS paths, we need to use absolute paths
return {
Expand Down

0 comments on commit e444375

Please sign in to comment.