From af2e2da27ce5c9e9ae5d486c43d7dfcc1ce51a4f Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 24 Apr 2024 11:43:06 +0100 Subject: [PATCH] fix(vite): inline styles for vue components with `lang="ts"` (#26912) --- packages/vite/src/plugins/ssr-styles.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/vite/src/plugins/ssr-styles.ts b/packages/vite/src/plugins/ssr-styles.ts index 8fe1b99ff8..130c4e7985 100644 --- a/packages/vite/src/plugins/ssr-styles.ts +++ b/packages/vite/src/plugins/ssr-styles.ts @@ -120,6 +120,9 @@ export function ssrStylesPlugin (options: SSRStylePluginOptions): Plugin { // Vue files can (also) be their own entrypoints as they are tracked separately if (isVue(moduleId)) { options.clientCSSMap[moduleId].add(moduleId) + const parent = moduleId.replace(/\?.+$/, '') + options.clientCSSMap[parent] ||= new Set() + options.clientCSSMap[parent].add(moduleId) } // This is required to track CSS in entry chunk if (isEntry) {