FE_FE
2017-07-07 18:24
{
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
bowsers ==》 bowserslist
...碰到同样问题,为什么
同问,为什么同写在一个文件里不行,而要把postcss-loader写到另外的config里才可以?
同是这个错
第一步,在根目录下新建postcss.config.js,里面内如下
第二步,webpack.config.js中
webpack深入与实战
86561 学习 · 721 问题
相似问题