File tree 2 files changed +14
-5
lines changed
packages/react-scripts/config
2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change
1
+ var ExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ;
2
+
1
3
module . exports = {
2
4
'BABEL_STAGE_0' : {
3
5
toArray : 'presets' ,
4
- get : function ( ) {
6
+ getDev : function ( ) {
5
7
return require . resolve ( 'babel-preset-stage-0' )
6
8
}
7
9
} ,
8
10
'DECORATORS' : {
9
11
toArray : 'babelPlugins' ,
10
- get : function ( ) {
12
+ getDev : function ( ) {
11
13
return require . resolve ( 'babel-plugin-transform-decorators-legacy' )
12
14
}
13
15
} ,
14
16
'SASS' : {
15
17
toArray : 'loaders' ,
16
- get : function ( ) {
18
+ getDev : function ( ) {
17
19
return {
18
20
test : / \. s c s s $ / ,
19
21
loader : "style!css!postcss!sass"
20
22
}
23
+ } ,
24
+ getProd : function ( ) {
25
+ return {
26
+ test : / \. s c s s $ / ,
27
+ loader : ExtractTextPlugin . extract ( 'style' , 'css!postcss!sass' )
28
+ }
21
29
}
22
30
} ,
23
31
'LESS' : {
24
32
toArray : 'loaders' ,
25
- get : function ( ) {
33
+ getDev : function ( ) {
26
34
return {
27
35
test : / \. l e s s $ / ,
28
36
loader : "style!css!postcss!less"
Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ function getCustomConfig(prod) {
14
14
var envValue = process . env [ 'REACT_APP_' + customizerKey ] ;
15
15
if ( env && envValue && envValue !== 'false' ) {
16
16
if ( customizer . toArray ) {
17
- finalConfig [ customizer . toArray ] . push ( customizer . get ( ) ) ;
17
+ var getCustomizer = ( prod ? customizer . getProd : customizer . getDev ) || customizer . getDev ;
18
+ finalConfig [ customizer . toArray ] . push ( getCustomizer ( ) ) ;
18
19
}
19
20
finalConfig . values [ customizerKey ] = customizer . config || true ;
20
21
}
You can’t perform that action at this time.
0 commit comments