@@ -12,6 +12,7 @@ const postcssUrl = require('postcss-url');
1212const autoprefixer = require ( 'autoprefixer' ) ;
1313const ExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ;
1414const customProperties = require ( 'postcss-custom-properties' ) ;
15+ const postcssImports = require ( 'postcss-import' ) ;
1516
1617/**
1718 * Enumerate loaders and their dependencies from this file to let the dependency validator
@@ -64,6 +65,33 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
6465 } ;
6566
6667 return [
68+ postcssImports ( {
69+ resolve : ( url : string , context : string ) => {
70+ return new Promise < string > ( ( resolve , reject ) => {
71+ loader . resolve ( context , url , ( err : Error , result : string ) => {
72+ if ( err ) {
73+ reject ( err ) ;
74+ return ;
75+ }
76+
77+ resolve ( result ) ;
78+ } ) ;
79+ } ) ;
80+ } ,
81+ load : ( filename : string ) => {
82+ return new Promise < string > ( ( resolve , reject ) => {
83+ loader . fs . readFile ( filename , ( err : Error , data : Buffer ) => {
84+ if ( err ) {
85+ reject ( err ) ;
86+ return ;
87+ }
88+
89+ const content = data . toString ( ) ;
90+ resolve ( content ) ;
91+ } ) ;
92+ } ) ;
93+ }
94+ } ) ,
6795 postcssUrl ( {
6896 filter : ( { url } : PostcssUrlAsset ) => url . startsWith ( '~' ) ,
6997 url : ( { url } : PostcssUrlAsset ) => {
@@ -109,7 +137,8 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
109137 'autoprefixer' : 'autoprefixer' ,
110138 'postcss-url' : 'postcssUrl' ,
111139 'cssnano' : 'cssnano' ,
112- 'postcss-custom-properties' : 'customProperties'
140+ 'postcss-custom-properties' : 'customProperties' ,
141+ 'postcss-import' : 'postcssImports' ,
113142 } ,
114143 variables : { minimizeCss, baseHref, deployUrl, projectRoot }
115144 } ;
@@ -182,7 +211,7 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
182211 loader : 'css-loader' ,
183212 options : {
184213 sourceMap : cssSourceMap ,
185- importLoaders : 1 ,
214+ import : false ,
186215 }
187216 } ,
188217 {
0 commit comments