From 364ad09e66cc88dcb51a58d0eaa5d01ddcc84116 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 20 Jun 2022 18:05:57 +0800 Subject: [PATCH] fix: always pass id to stylePostLoader when possible for css v-bind compilation --- lib/codegen/styleInjection.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/codegen/styleInjection.js b/lib/codegen/styleInjection.js index e6e2b8311..01075a5a9 100644 --- a/lib/codegen/styleInjection.js +++ b/lib/codegen/styleInjection.js @@ -23,9 +23,9 @@ module.exports = function genStyleInjectionCode( const src = style.src || resourcePath const attrsQuery = attrsToQuery(style.attrs, 'css') const inheritQuery = `&${loaderContext.resourceQuery.slice(1)}` - // make sure to only pass id when necessary so that we don't inject + // make sure to only pass id not src importing so that we don't inject // duplicate tags when multiple components import the same css file - const idQuery = style.scoped ? `&id=${id}` : `` + const idQuery = !style.src || style.scoped ? `&id=${id}` : `` const prodQuery = isProduction ? `&prod` : `` const query = `?vue&type=style&index=${i}${idQuery}${prodQuery}${attrsQuery}${inheritQuery}` return stringifyRequest(src + query)