File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
packages/@angular/cli/models/webpack-configs Expand file tree Collapse file tree 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) {
185185 ...commonLoaders ,
186186 ...( use as webpack . Loader [ ] )
187187 ] ,
188- fallback : 'style-loader' ,
189188 // publicPath needed as a workaround https://github.com/angular/angular-cli/issues/4035
190189 publicPath : ''
191190 } ;
192191 const ret : any = {
193192 include : globalStylePaths ,
194193 test,
195- use : ExtractTextPlugin . extract ( extractTextPlugin )
194+ use : buildOptions . extractCss ? ExtractTextPlugin . extract ( extractTextPlugin )
195+ : [ 'style-loader' , ...extractTextPlugin . use ]
196196 } ;
197197 // Save the original options as arguments for eject.
198- ret [ pluginArgs ] = extractTextPlugin ;
198+ if ( buildOptions . extractCss ) {
199+ ret [ pluginArgs ] = extractTextPlugin ;
200+ }
199201 return ret ;
200202 } ) ) ;
201203 }
202204
203205 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` } ) ) ;
204209 // suppress empty .js files in css only entry points
205210 extraPlugins . push ( new SuppressExtractedTextChunksWebpackPlugin ( ) ) ;
206211 }
207212
208213 return {
209214 entry : entryPoints ,
210215 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 )
218217 } ;
219218}
You can’t perform that action at this time.
0 commit comments