File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -262,7 +262,8 @@ module.exports = {
262262 }
263263 } ) ;
264264 if ( this . postcss && itemLoader . postcss ) {
265- const postcssIndex = [ 'css' , 'css_module' ] . includes ( name ) ? itemLoader . use . length : itemLoader . use . length - 1 ;
265+ const cssIndex = this . utils . getLoaderIndex ( itemLoader . use , 'css-loader' ) ;
266+ const postcssIndex = cssIndex ? cssIndex : this . utils . getLoaderIndex ( itemLoader . use , 'style-loader' ) ;
266267 const postcssLoader = this . createPostCssLoader ( loaderOptions && loaderOptions . postcss ) ;
267268 itemLoader . use . splice ( postcssIndex , 0 , postcssLoader ) ;
268269 }
Original file line number Diff line number Diff line change @@ -81,6 +81,10 @@ utils.joinPath = function() {
8181 } ) . join ( '/' ) ;
8282} ;
8383
84+ utils . getLoaderIndex = ( loaders , loaderName ) => {
85+ return loaders . findIndex ( loader => loaderName === ( utils . isObject ( loader ) ? loader . loader : loader ) ) + 1 ;
86+ }
87+
8488utils . getOutputPath = config => {
8589 const { output = { } , buildPath } = config ;
8690 if ( output . path ) {
You can’t perform that action at this time.
0 commit comments