Commit 6764679 1 parent b07f631 commit 6764679 Copy full SHA for 6764679
File tree 1 file changed +9
-10
lines changed
packages/@angular/cli/models/webpack-configs
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -185,35 +185,34 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
185
185
...commonLoaders ,
186
186
...( use as webpack . Loader [ ] )
187
187
] ,
188
- fallback : 'style-loader' ,
189
188
// publicPath needed as a workaround https://github.com/angular/angular-cli/issues/4035
190
189
publicPath : ''
191
190
} ;
192
191
const ret : any = {
193
192
include : globalStylePaths ,
194
193
test,
195
- use : ExtractTextPlugin . extract ( extractTextPlugin )
194
+ use : buildOptions . extractCss ? ExtractTextPlugin . extract ( extractTextPlugin )
195
+ : [ 'style-loader' , ...extractTextPlugin . use ]
196
196
} ;
197
197
// Save the original options as arguments for eject.
198
- ret [ pluginArgs ] = extractTextPlugin ;
198
+ if ( buildOptions . extractCss ) {
199
+ ret [ pluginArgs ] = extractTextPlugin ;
200
+ }
199
201
return ret ;
200
202
} ) ) ;
201
203
}
202
204
203
205
if ( buildOptions . extractCss ) {
206
+ // extract global css from js files into own css file
207
+ extraPlugins . push (
208
+ new ExtractTextPlugin ( { filename : `[name]${ hashFormat . extract } .bundle.css` } ) ) ;
204
209
// suppress empty .js files in css only entry points
205
210
extraPlugins . push ( new SuppressExtractedTextChunksWebpackPlugin ( ) ) ;
206
211
}
207
212
208
213
return {
209
214
entry : entryPoints ,
210
215
module : { rules } ,
211
- plugins : [
212
- // extract global css from js files into own css file
213
- new ExtractTextPlugin ( {
214
- filename : `[name]${ hashFormat . extract } .bundle.css` ,
215
- disable : ! buildOptions . extractCss
216
- } )
217
- ] . concat ( extraPlugins )
216
+ plugins : [ ] . concat ( extraPlugins )
218
217
} ;
219
218
}
You can’t perform that action at this time.
0 commit comments