File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1+ @import "autoprefixer_test.css" ;
Original file line number Diff line number Diff line change @@ -18,17 +18,24 @@ const loaderFeatures = require('../loader-features');
1818 */
1919module . exports = {
2020 getLoaders ( webpackConfig , skipPostCssLoader ) {
21+ const usePostCssLoader = webpackConfig . usePostCssLoader && ! skipPostCssLoader ;
22+
2123 const cssLoaders = [
2224 {
2325 loader : 'css-loader' ,
2426 options : {
2527 minimize : webpackConfig . isProduction ( ) ,
26- sourceMap : webpackConfig . useSourceMaps
28+ sourceMap : webpackConfig . useSourceMaps ,
29+ // when using @import , how many loaders *before* css-loader should
30+ // be applied to those imports? This defaults to 0. When postcss-loader
31+ // is used, we set it to 1, so that postcss-loader is applied
32+ // to @import resources.
33+ importLoaders : usePostCssLoader ? 1 : 0
2734 }
2835 } ,
2936 ] ;
3037
31- if ( webpackConfig . usePostCssLoader && ! skipPostCssLoader ) {
38+ if ( usePostCssLoader ) {
3239 loaderFeatures . ensureLoaderPackagesExist ( 'postcss' ) ;
3340
3441 cssLoaders . push ( {
Original file line number Diff line number Diff line change @@ -483,7 +483,9 @@ module.exports = {
483483
484484 const config = testSetup . createWebpackConfig ( appDir , 'www/build' , 'dev' ) ;
485485 config . setPublicPath ( '/build' ) ;
486- config . addStyleEntry ( 'styles' , [ './css/autoprefixer_test.css' ] ) ;
486+ // load a file that @import 's another file, so that we can
487+ // test that @import resources are parsed through postcss
488+ config . addStyleEntry ( 'styles' , [ './css/imports_autoprefixer.css' ] ) ;
487489 config . enablePostCssLoader ( ) ;
488490
489491 testSetup . runWebpack ( config , ( webpackAssert ) => {
You can’t perform that action at this time.
0 commit comments