第二种打包import的css报错
{
test: /\.css$/,
//user可为loader加入选项
use: [
'style-loader',
{loader: 'css-loader',options: {importLoaders: 1}},
{loader: 'postcss-loader',options: {plugins: [require('autoprefixer')({browsers:["last 5 versions"]})]}}
],
}
ERROR in ./node_modules/css-loader?{"importLoaders":1}!./node_modules/postcss-loader/lib?{"plugins":[null]}!./src/css/flex.css
Module build failed: TypeError: Cannot read property 'postcss' of null
at Processor.normalize (F:\webpack-demo\node_modules\postcss-loader\node_modules\postcss\lib\processor.js:136:12)
at new Processor (F:\webpack-demo\node_modules\postcss-loader\node_modules\postcss\lib\processor.js:51:25)
at postcss (F:\webpack-demo\node_modules\postcss-loader\node_modules\postcss\lib\postcss.js:73:10)
at Promise.resolve.then.then (F:\webpack-demo\node_modules\postcss-loader\lib\index.js:137:12)
at <anonymous>
@ ./node_modules/css-loader?{"importLoaders":1}!./node_modules/postcss-loader/lib?{"plugins":[null]}!./src/css/common.css 3:10-162
@ ./src/css/common.css
@ ./src/app.js