From 3ac8b18cb6145e49c30d42a5f327c0ed33862f3f Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 13 Feb 2024 09:53:46 +0000 Subject: [PATCH] fix(vite): strip query strings for style chunk filenames (#25764) --- packages/vite/src/plugins/ssr-styles.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/plugins/ssr-styles.ts b/packages/vite/src/plugins/ssr-styles.ts index 46a6e5345f..56afc02312 100644 --- a/packages/vite/src/plugins/ssr-styles.ts +++ b/packages/vite/src/plugins/ssr-styles.ts @@ -2,7 +2,7 @@ import { pathToFileURL } from 'node:url' import type { Plugin } from 'vite' import { dirname, relative } from 'pathe' import { genImport, genObjectFromRawEntries } from 'knitwork' -import { filename } from 'pathe/utils' +import { filename as _filename } from 'pathe/utils' import { parseQuery, parseURL } from 'ufo' import type { Component } from '@nuxt/schema' import MagicString from 'magic-string' @@ -235,3 +235,7 @@ export function ssrStylesPlugin (options: SSRStylePluginOptions): Plugin { } } } + +function filename (name: string) { + return _filename(name.replace(/\?.+$/, '')) +}