@@ -36,14 +36,14 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
3636
3737 // discard comments in production
3838 const extraPostCssPlugins = buildOptions . target === 'production'
39- ? [ postcssDiscardComments ]
40- : [ ] ;
39+ ? [ postcssDiscardComments ]
40+ : [ ] ;
4141
4242 // determine hashing format
4343 const hashFormat = getOutputHashFormat ( buildOptions . outputHashing ) ;
4444
4545 // use includePaths from appConfig
46- const includePaths : string [ ] = [ ] ;
46+ const includePaths : string [ ] = [ ] ;
4747
4848 if ( appConfig . stylePreprocessorOptions
4949 && appConfig . stylePreprocessorOptions . includePaths
@@ -72,11 +72,13 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
7272 { test : / \. s c s s $ | \. s a s s $ / , loaders : [ 'sass-loader' ] } ,
7373 { test : / \. l e s s $ / , loaders : [ 'less-loader' ] } ,
7474 // stylus-loader doesn't support webpack.LoaderOptionsPlugin properly,
75- // so we need to add options in it's query
76- { test : / \. s t y l $ / , loaders : [ `stylus-loader?${ JSON . stringify ( {
77- sourceMap : buildOptions . sourcemap ,
78- paths : includePaths
79- } ) } `] }
75+ // so we need to add options in its query
76+ {
77+ test : / \. s t y l $ / , loaders : [ `stylus-loader?${ JSON . stringify ( {
78+ sourceMap : buildOptions . sourcemap ,
79+ paths : includePaths
80+ } ) } `]
81+ }
8082 ] ;
8183
8284 const commonLoaders = [ 'postcss-loader' ] ;
@@ -91,7 +93,13 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
9193 rules . push ( ...baseRules . map ( ( { test, loaders} ) => ( {
9294 include : globalStylePaths , test, loaders : ExtractTextPlugin . extract ( {
9395 remove : false ,
94- loader : [ 'css-loader' , ...commonLoaders , ...loaders ] ,
96+ loader : [
97+ // css-loader doesn't support webpack.LoaderOptionsPlugin properly,
98+ // so we need to add options in its query
99+ `css-loader?${ JSON . stringify ( { sourceMap : buildOptions . sourcemap } ) } ` ,
100+ ...commonLoaders ,
101+ ...loaders
102+ ] ,
95103 fallbackLoader : 'style-loader' ,
96104 // publicPath needed as a workaround https://github.com/angular/angular-cli/issues/4035
97105 publicPath : ''
@@ -114,13 +122,14 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
114122 disable : ! buildOptions . extractCss
115123 } ) ,
116124 new webpack . LoaderOptionsPlugin ( {
125+ sourceMap : true ,
117126 options : {
118127 postcss : [ autoprefixer ( ) ] . concat ( extraPostCssPlugins ) ,
119- cssLoader : { sourceMap : buildOptions . sourcemap } ,
128+ // css-loader, stylus-loader don't support LoaderOptionsPlugin properly
129+ // options are in query instead
120130 sassLoader : { sourceMap : buildOptions . sourcemap , includePaths } ,
121131 // less-loader doesn't support paths
122132 lessLoader : { sourceMap : buildOptions . sourcemap } ,
123- // stylus-loader doesn't support LoaderOptionsPlugin properly, options in query instead
124133 // context needed as a workaround https://github.com/jtangelder/sass-loader/issues/285
125134 context : projectRoot ,
126135 } ,
0 commit comments