mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
fix(nuxt): always inline entry styles (#7386)
This commit is contained in:
parent
e60d03b940
commit
83949c3734
@ -224,7 +224,7 @@ function renderHTMLDocument (html: NuxtRenderHTMLContext) {
|
||||
async function renderInlineStyles (usedModules: Set<string> | string[]) {
|
||||
const styleMap = await getSSRStyles()
|
||||
const inlinedStyles = new Set<string>()
|
||||
for (const mod of usedModules) {
|
||||
for (const mod of ['entry', ...usedModules]) {
|
||||
if (mod in styleMap) {
|
||||
for (const style of await styleMap[mod]()) {
|
||||
inlinedStyles.add(`<style>${style}</style>`)
|
||||
|
@ -60,11 +60,11 @@ export function ssrStylesPlugin (options: SSRStylePluginOptions): Plugin {
|
||||
source:
|
||||
[
|
||||
...globalStylesArray.map((css, i) => `import style_${i} from './${css}';`),
|
||||
`const globalStyles = [${globalStylesArray.map((_, i) => `style_${i}`).join(', ')}]`,
|
||||
'const resolveStyles = r => globalStyles.concat(r.default || r || [])',
|
||||
`export default ${genObjectFromRawEntries(
|
||||
Object.entries(emitted).map(([key, value]) => [key, `() => import('./${this.getFileName(value)}').then(resolveStyles)`])
|
||||
)}`
|
||||
'const interopDefault = r => r.default || r || []',
|
||||
`export default ${genObjectFromRawEntries([
|
||||
['entry', `() => [${globalStylesArray.map((_, i) => `style_${i}`).join(', ')}]`],
|
||||
...Object.entries(emitted).map(([key, value]) => [key, `() => import('./${this.getFileName(value)}').then(interopDefault)`]) as [string, string][]
|
||||
])}`
|
||||
].join('\n')
|
||||
})
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user