File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -336,7 +336,8 @@ class WebpackBaseBuilder extends Config {
336336 if ( Array . isArray ( itemLoader . use ) ) {
337337 if ( itemLoader . postcss ) {
338338 const postcssIndex = [ 'css' , 'css_module' ] . includes ( name ) ? itemLoader . use . length : itemLoader . use . length - 1 ;
339- itemLoader . use . splice ( postcssIndex , 0 , 'postcss-loader' ) ;
339+ const postcssLoader = this . createPostCssLoader ( loaderOptions && loaderOptions . postcss ) ;
340+ itemLoader . use . splice ( postcssIndex , 0 , postcssLoader ) ;
340341 }
341342 itemLoader . use . forEach ( ( loader , index ) => {
342343 const label = this . utils . getLoaderLabel ( loader ) ;
@@ -577,6 +578,11 @@ class WebpackBaseBuilder extends Config {
577578 this . styleLoader = { loader, options } ;
578579 }
579580
581+ createPostCssLoader ( loaderOptions ) {
582+ const options = this . merge ( this . config . devtool ? { sourceMap : true } : { } , loaderOptions ) ;
583+ return { loader : 'postcss-loader' , options } ;
584+ }
585+
580586 createDllPlugin ( dll ) {
581587 dll = dll || this . config . dll ;
582588 const dllArray = WebpackBaseBuilder . getDllConfig ( dll ) ;
You can’t perform that action at this time.
0 commit comments