@@ -191,12 +191,14 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
191
191
}
192
192
193
193
const { supportedBrowsers } = new BuildBrowserFeatures ( wco . projectRoot ) ;
194
- const postcssOptionsCreator = ( sourceMap : boolean , extracted : boolean | undefined ) => {
194
+ const postcssOptionsCreator = ( inlineSourcemaps : boolean , extracted : boolean | undefined ) => {
195
195
return ( loader : webpack . loader . LoaderContext ) => ( {
196
- map : sourceMap && {
197
- inline : true ,
198
- annotation : false ,
199
- } ,
196
+ map : inlineSourcemaps
197
+ ? {
198
+ inline : true ,
199
+ annotation : false ,
200
+ }
201
+ : undefined ,
200
202
plugins : [
201
203
postcssImports ( {
202
204
resolve : ( url : string ) => url . startsWith ( '~' ) ? url . substr ( 1 ) : url ,
@@ -264,8 +266,6 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
264
266
265
267
// load global css as css files
266
268
if ( globalStylePaths . length > 0 ) {
267
- const globalSourceMap = ! ! cssSourceMap && ! buildOptions . sourceMap . hidden ;
268
-
269
269
rules . push (
270
270
...baseRules . map ( ( { test, use } ) => {
271
271
return {
@@ -281,14 +281,15 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
281
281
loader : require . resolve ( 'css-loader' ) ,
282
282
options : {
283
283
url : false ,
284
- sourceMap : globalSourceMap ,
284
+ sourceMap : ! ! cssSourceMap ,
285
285
} ,
286
286
} ,
287
287
{
288
288
loader : require . resolve ( 'postcss-loader' ) ,
289
289
options : {
290
290
implementation : require ( 'postcss' ) ,
291
- postcssOptions : postcssOptionsCreator ( globalSourceMap , buildOptions . extractCss ) ,
291
+ postcssOptions : postcssOptionsCreator ( false , buildOptions . extractCss ) ,
292
+ sourceMap : ! ! cssSourceMap ,
292
293
} ,
293
294
} ,
294
295
...use ,
0 commit comments