This commit is contained in:
Julien Huang 2025-02-18 11:13:51 +01:00 committed by GitHub
commit 45ee6d0da4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 6 deletions

View File

@ -85,7 +85,7 @@ export const bundle: NuxtBuilder['bundle'] = async (nuxt) => {
// https://github.com/vitejs/vite/tree/main/packages/vite/src/node/build.ts#L464-L478
assetFileNames: nuxt.options.dev
? undefined
: chunk => withoutLeadingSlash(join(nuxt.options.app.buildAssetsDir, `${sanitizeFilePath(filename(chunk.names[0]!))}.[hash].[ext]`)),
: chunk => withoutLeadingSlash(join(nuxt.options.app.buildAssetsDir, `${sanitizeFilePath(filename(chunk.names[0]!))}-[hash].[ext]`)),
},
},
watch: {

View File

@ -1864,7 +1864,7 @@ describe.skipIf(isDev() || isWebpack)('inlining component styles', () => {
// @ts-expect-error ssssh! untyped secret property
const publicDir = useTestContext().nuxt._nitro.options.output.publicDir
const files = await readdir(join(publicDir, '_nuxt')).catch(() => [])
expect(files.map(m => m.replace(/\.[\w-]+(\.\w+)$/, '$1'))).toContain('css-only-asset.svg')
expect(JSON.stringify(files.map(m => m.replace(/(-\w+)(\.\w+)$/, '$2')))).toContain('css_only_asset.svg')
})
it('should not include inlined CSS in generated CSS file', async () => {
@ -1892,7 +1892,7 @@ describe.skipIf(isDev() || isWebpack)('inlining component styles', () => {
const html: string = await $fetch<string>('/styles')
const cssFiles = html.match(/<link [^>]*href="[^"]*\.css"/g)
expect(cssFiles?.length).toBeGreaterThan(0)
expect(cssFiles?.filter(m => m.includes('entry'))?.map(m => m.replace(/\.[^.]*\.css/, '.css'))).toMatchInlineSnapshot(`
expect(cssFiles?.filter(m => m.includes('entry'))?.map(m => m.replace(/-[^-]*\.css/, '.css'))).toMatchInlineSnapshot(`
[
"<link rel="stylesheet" href="/_nuxt/entry.css"",
]
@ -2122,7 +2122,7 @@ describe('public directories', () => {
// TODO: dynamic paths in dev
describe.skipIf(isDev())('dynamic paths', () => {
const publicFiles = ['/public.svg', '/css-only-public-asset.svg']
const publicFiles = ['/public.svg', '/css_only_public_asset.svg']
const isPublicFile = (base = '/', file: string) => {
if (isWebpack) {
// TODO: webpack does not yet support dynamic static paths

View File

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 201 B

View File

@ -1,5 +1,5 @@
:root {
--global: 'global';
--asset: url('~/assets/css-only-asset.svg');
--public-asset: url('/css-only-public-asset.svg');
--asset: url('~/assets/css_only_asset.svg');
--public-asset: url('/css_only_public_asset.svg');
}

View File

Before

Width:  |  Height:  |  Size: 67 B

After

Width:  |  Height:  |  Size: 67 B