Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(nuxt): normalize manifest css file entries (#6112)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas authored Jul 25, 2022
1 parent 40defd9 commit 210cf30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/nuxt/src/core/runtime/nitro/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ const getSPARenderer = lazyCachedFunction(async () => {
if ('all' in clientManifest && 'initial' in clientManifest) {
// Upgrade legacy manifest (also see normalizeClientManifest in vue-bundle-renderer)
// https://github.com/nuxt-contrib/vue-bundle-renderer/issues/12
entryFiles = clientManifest.initial.map(file => ({ file }))
entryFiles = clientManifest.initial.map(file =>
// Webpack manifest fix with SPA renderer
file.endsWith('css') ? { css: file } : { file }
)
}

return Promise.resolve({
Expand All @@ -97,6 +100,7 @@ const getSPARenderer = lazyCachedFunction(async () => {
.join(''),
renderScripts: () =>
entryFiles
.filter(({ file }) => file)
.map(({ file }) => {
const isMJS = !file.endsWith('.js')
return `<script ${isMJS ? 'type="module"' : ''} src="${buildAssetsURL(file)}"></script>`
Expand Down
6 changes: 6 additions & 0 deletions test/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ describe('head tags', () => {
// should render <Head> components
expect(index).toContain('<title>Basic fixture - Fixture</title>')
})

// TODO: Doesn't adds header in test environment
// it.todo('should render stylesheet link tag (SPA mode)', async () => {
// const html = await $fetch('/head', { headers: { 'x-nuxt-no-ssr': '1' } })
// expect(html).toMatch(/<link rel="stylesheet" href="\/_nuxt\/[^>]*.css"/)
// })
})

describe('navigate', () => {
Expand Down

0 comments on commit 210cf30

Please sign in to comment.