fix(vite): remove dev styles injected via absolute path (#23126)

This commit is contained in:
Daniel Roe 2023-09-11 14:40:47 +01:00 committed by GitHub
parent f79f9b3a60
commit c045c4b154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,8 +23,8 @@ export function devStyleSSRPlugin (options: DevStyleSSRPluginOptions): Plugin {
}
// When dev `<style>` is injected, remove the `<link>` styles from manifest
const selector = joinURL(options.buildAssetsURL, moduleId)
return code + `\ndocument.querySelectorAll(\`link[href="${selector}"]\`).forEach(i=>i.remove())`
const selectors = [joinURL(options.buildAssetsURL, moduleId), joinURL(options.buildAssetsURL, '@fs', moduleId)]
return code + selectors.map(selector => `\ndocument.querySelectorAll(\`link[href="${selector}"]\`).forEach(i=>i.remove())`).join('')
}
}
}