@@ -36,14 +36,14 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
36
36
37
37
// discard comments in production
38
38
const extraPostCssPlugins = buildOptions . target === 'production'
39
- ? [ postcssDiscardComments ]
40
- : [ ] ;
39
+ ? [ postcssDiscardComments ]
40
+ : [ ] ;
41
41
42
42
// determine hashing format
43
43
const hashFormat = getOutputHashFormat ( buildOptions . outputHashing ) ;
44
44
45
45
// use includePaths from appConfig
46
- const includePaths : string [ ] = [ ] ;
46
+ const includePaths : string [ ] = [ ] ;
47
47
48
48
if ( appConfig . stylePreprocessorOptions
49
49
&& appConfig . stylePreprocessorOptions . includePaths
@@ -72,11 +72,13 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
72
72
{ test : / \. s c s s $ | \. s a s s $ / , loaders : [ 'sass-loader' ] } ,
73
73
{ test : / \. l e s s $ / , loaders : [ 'less-loader' ] } ,
74
74
// 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
+ }
80
82
] ;
81
83
82
84
const commonLoaders = [ 'postcss-loader' ] ;
@@ -91,7 +93,13 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
91
93
rules . push ( ...baseRules . map ( ( { test, loaders} ) => ( {
92
94
include : globalStylePaths , test, loaders : ExtractTextPlugin . extract ( {
93
95
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
+ ] ,
95
103
fallbackLoader : 'style-loader' ,
96
104
// publicPath needed as a workaround https://github.com/angular/angular-cli/issues/4035
97
105
publicPath : ''
@@ -114,13 +122,14 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
114
122
disable : ! buildOptions . extractCss
115
123
} ) ,
116
124
new webpack . LoaderOptionsPlugin ( {
125
+ sourceMap : true ,
117
126
options : {
118
127
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
120
130
sassLoader : { sourceMap : buildOptions . sourcemap , includePaths } ,
121
131
// less-loader doesn't support paths
122
132
lessLoader : { sourceMap : buildOptions . sourcemap } ,
123
- // stylus-loader doesn't support LoaderOptionsPlugin properly, options in query instead
124
133
// context needed as a workaround https://github.com/jtangelder/sass-loader/issues/285
125
134
context : projectRoot ,
126
135
} ,
0 commit comments