File tree 3 files changed +13
-3
lines changed
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');
18
18
*/
19
19
module . exports = {
20
20
getLoaders ( webpackConfig , skipPostCssLoader ) {
21
+ const usePostCssLoader = webpackConfig . usePostCssLoader && ! skipPostCssLoader ;
22
+
21
23
const cssLoaders = [
22
24
{
23
25
loader : 'css-loader' ,
24
26
options : {
25
27
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
27
34
}
28
35
} ,
29
36
] ;
30
37
31
- if ( webpackConfig . usePostCssLoader && ! skipPostCssLoader ) {
38
+ if ( usePostCssLoader ) {
32
39
loaderFeatures . ensureLoaderPackagesExist ( 'postcss' ) ;
33
40
34
41
cssLoaders . push ( {
Original file line number Diff line number Diff line change @@ -483,7 +483,9 @@ module.exports = {
483
483
484
484
const config = testSetup . createWebpackConfig ( appDir , 'www/build' , 'dev' ) ;
485
485
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' ] ) ;
487
489
config . enablePostCssLoader ( ) ;
488
490
489
491
testSetup . runWebpack ( config , ( webpackAssert ) => {
You can’t perform that action at this time.
0 commit comments