qq_唐大虾_03914583
2017-05-15 14:07
var htmlWebpackPlugin = require("html-webpack-plugin");
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: './src/app.js',
output: {
path: __dirname + '/dist',
filename: 'js/[name]-bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
include: '/src/',
exclude: '/node_modules/',
loaders: "babel-loader",
query: {
presets: ["latest"]
}
},
{
test:/\.css$/,
use:[
{
loader:'style-loader'
},
{
loader:'css-loader',
options:{
importLoaders:1
}
},
{
loader:'postcss-loader'
}
]
}
]
},
plugins: [
new htmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: 'body',
}),
new webpack.LoaderOptionsPlugin({
options: {
postcss: function(){
return [
require('autoprefixer')({
broswers: ['last 5 versions']
})
]
}
}
})
]
}
为什么我还是不行,我也已经配置了postcss.config.js 文件了
module.exports = {
plugins:[
require('autoprefixer')({ browsers: ["last 5 versions"]})
]
}
还是报这个错
{ test: /\.css$/, use: [ { loader:'style-loader' }, { loader:'css-loader' }, { loader: 'postcss-loader', // some plugins of postcss-loader:some options options: { plugins: function () { return [ require('postcss-import')({ root:this.resourcePath }), require('autoprefixer')({ broswers: ['last 5 versions'] }) ] } } } ] },
{ test: /\.css$/, loaders: [ "style-loader", "css-loader?importLoaders=1", { loader: "postcss-loader", options: { plugins: (loader)=>[ require('autoprefixer')({ broswers:['last 5 versions'] }) ] }, } ], }
这么配置
webpack深入与实战
86561 学习 · 721 问题
相似问题