报错,webpack.loaderOptionsPlugin不是一个构造函数

const path = require('path');

const htmlWebpackPlugin = require('html-webpack-plugin');

const webpack =require('webpack');

module.exports = {

entry:{app:'./src/app.js'},

output:{

filename:'js/[name].bundle.js',

path:path.resolve(__dirname,'dist')

},

module:{

loaders:[

{

test:/\.js$/,

loader:'babel-loader',

exclude:path.resolve(__dirname,'node_modules'),

include:path.resolve(__dirname,'src'),

query:{

presets:['latest']

}

},

{

test:/\.css$/,

loader:'style-loader!css-loader!postcss-loader'

}

]

},

plugins:[

 new htmlWebpackPlugin({

  filename:'index.html',

  template:'index.html',

  inject:'body',

 }),

 new webpack.loaderOptionsPlugin({

  options:{

  postcss:[require('autoprefixer')({ browsers: ['last 2 versions'] })]

  }

 

 })

]

}

我要做的是给css3加前缀,但是拨错

TypeError: webpack.loaderOptionsPlugin is not a constructor,请大神指导

sxy1990
浏览 3281回答 2
2回答

我啊我诶

这个应该是因为你的webpack版本不对吧,2.0以后的版本才能使用loaderOptionsPlugin

qq_万法自如_0

我的问题是plugins写成了plugin
打开App,查看更多内容
随时随地看视频慕课网APP