File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ module.exports = function genStyleInjectionCode(
99 resourcePath ,
1010 stringifyRequest ,
1111 needsHotReload ,
12- needsExplicitInjection
12+ needsExplicitInjection ,
13+ isProduction
1314) {
1415 let styleImportsCode = ``
1516 let styleInjectionCode = ``
@@ -25,7 +26,8 @@ module.exports = function genStyleInjectionCode(
2526 // make sure to only pass id when necessary so that we don't inject
2627 // duplicate tags when multiple components import the same css file
2728 const idQuery = style . scoped ? `&id=${ id } ` : ``
28- const query = `?vue&type=style&index=${ i } ${ idQuery } ${ attrsQuery } ${ inheritQuery } `
29+ const prodQuery = isProduction ? `&prod` : ``
30+ const query = `?vue&type=style&index=${ i } ${ idQuery } ${ prodQuery } ${ attrsQuery } ${ inheritQuery } `
2931 return stringifyRequest ( src + query )
3032 }
3133
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ module.exports = function (source) {
3131 const stringifyRequest = ( r ) => loaderUtils . stringifyRequest ( loaderContext , r )
3232
3333 const {
34+ mode,
3435 target,
3536 request,
3637 minimize,
@@ -48,7 +49,11 @@ module.exports = function (source) {
4849 const isServer = target === 'node'
4950 const isShadow = ! ! options . shadowMode
5051 const isProduction =
51- options . productionMode || minimize || process . env . NODE_ENV === 'production'
52+ mode === 'production' ||
53+ options . productionMode ||
54+ minimize ||
55+ process . env . NODE_ENV === 'production'
56+
5257 const filename = path . basename ( resourcePath )
5358 const context = rootContext || process . cwd ( )
5459 const sourceRoot = path . dirname ( path . relative ( context , resourcePath ) )
@@ -141,7 +146,8 @@ module.exports = function (source) {
141146 resourcePath ,
142147 stringifyRequest ,
143148 needsHotReload ,
144- isServer || isShadow // needs explicit injection?
149+ isServer || isShadow , // needs explicit injection?
150+ isProduction
145151 )
146152 }
147153
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ module.exports = function (source, inMap) {
1313 id : `data-v-${ query . id } ` ,
1414 map : inMap ,
1515 scoped : ! ! query . scoped ,
16+ isProd : query . prod != null ,
1617 trim : true
1718 } )
1819
You can’t perform that action at this time.
0 commit comments