parent
5b3a976fd3
commit
d80fd97601
|
@ -167,7 +167,11 @@ export function parseJs(
|
|||
name = name.replace(/\.scss/, '.css')
|
||||
}
|
||||
let tmp = `style${Date.now()}`
|
||||
fixedStyle += `document.adoptedStyleSheets.push(${tmp})\n`
|
||||
fixedStyle += `
|
||||
let __sheets__ = [...document.adoptedStyleSheets]
|
||||
__sheets__.push(${tmp})
|
||||
document.adoptedStyleSheets = __sheets__
|
||||
`
|
||||
|
||||
// 修正那反人类的windows路径
|
||||
return `import ${tmp} from '${name}' assert { type: 'css' }\n${tmp}.path = '${name.replace(
|
||||
|
@ -277,9 +281,11 @@ export function compileVue(file, imports, options = {}, isBuild) {
|
|||
// 修正那反人类的windows路径
|
||||
output += `
|
||||
let stylesheet = new CSSStyleSheet()
|
||||
let __sheets__ = [...document.adoptedStyleSheets]
|
||||
stylesheet.path = '${filename}'
|
||||
stylesheet.replaceSync(\`${scss}\`)
|
||||
document.adoptedStyleSheets.push(stylesheet)
|
||||
__sheets__.push(stylesheet)
|
||||
document.adoptedStyleSheets = __sheets__
|
||||
`
|
||||
}
|
||||
if (scoped) {
|
||||
|
|
|
@ -48,7 +48,8 @@ export const HMR_SCRIPT = `
|
|||
let stylesheet = new CSSStyleSheet()
|
||||
stylesheet.path = data.path
|
||||
stylesheet.replaceSync(data.content)
|
||||
document.adoptedStyleSheets[i] = stylesheet
|
||||
tmp[i] = stylesheet
|
||||
document.adoptedStyleSheets = tmp
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "fite",
|
||||
"type": "module",
|
||||
"version": "0.6.2",
|
||||
"version": "0.7.0",
|
||||
"bin": {
|
||||
"fite": "index.js"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue