fix(vite): strip query strings for style chunk filenames (#25764)

This commit is contained in:
Daniel Roe 2024-02-13 09:53:46 +00:00 committed by GitHub
parent 75f05e95f2
commit 3ac8b18cb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,7 +2,7 @@ import { pathToFileURL } from 'node:url'
import type { Plugin } from 'vite' import type { Plugin } from 'vite'
import { dirname, relative } from 'pathe' import { dirname, relative } from 'pathe'
import { genImport, genObjectFromRawEntries } from 'knitwork' import { genImport, genObjectFromRawEntries } from 'knitwork'
import { filename } from 'pathe/utils' import { filename as _filename } from 'pathe/utils'
import { parseQuery, parseURL } from 'ufo' import { parseQuery, parseURL } from 'ufo'
import type { Component } from '@nuxt/schema' import type { Component } from '@nuxt/schema'
import MagicString from 'magic-string' import MagicString from 'magic-string'
@ -235,3 +235,7 @@ export function ssrStylesPlugin (options: SSRStylePluginOptions): Plugin {
} }
} }
} }
function filename (name: string) {
return _filename(name.replace(/\?.+$/, ''))
}