File tree 3 files changed +13
-4
lines changed
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(
9
9
resourcePath ,
10
10
stringifyRequest ,
11
11
needsHotReload ,
12
- needsExplicitInjection
12
+ needsExplicitInjection ,
13
+ isProduction
13
14
) {
14
15
let styleImportsCode = ``
15
16
let styleInjectionCode = ``
@@ -25,7 +26,8 @@ module.exports = function genStyleInjectionCode(
25
26
// make sure to only pass id when necessary so that we don't inject
26
27
// duplicate tags when multiple components import the same css file
27
28
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 } `
29
31
return stringifyRequest ( src + query )
30
32
}
31
33
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ module.exports = function (source) {
31
31
const stringifyRequest = ( r ) => loaderUtils . stringifyRequest ( loaderContext , r )
32
32
33
33
const {
34
+ mode,
34
35
target,
35
36
request,
36
37
minimize,
@@ -48,7 +49,11 @@ module.exports = function (source) {
48
49
const isServer = target === 'node'
49
50
const isShadow = ! ! options . shadowMode
50
51
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
+
52
57
const filename = path . basename ( resourcePath )
53
58
const context = rootContext || process . cwd ( )
54
59
const sourceRoot = path . dirname ( path . relative ( context , resourcePath ) )
@@ -141,7 +146,8 @@ module.exports = function (source) {
141
146
resourcePath ,
142
147
stringifyRequest ,
143
148
needsHotReload ,
144
- isServer || isShadow // needs explicit injection?
149
+ isServer || isShadow , // needs explicit injection?
150
+ isProduction
145
151
)
146
152
}
147
153
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ module.exports = function (source, inMap) {
13
13
id : `data-v-${ query . id } ` ,
14
14
map : inMap ,
15
15
scoped : ! ! query . scoped ,
16
+ isProd : query . prod != null ,
16
17
trim : true
17
18
} )
18
19
You can’t perform that action at this time.
0 commit comments