基于vue-cli 2 版本
//在webpack.base.conf.js 中添加即可 plugins: [ new HappyPack({
id: 'happy-babel-js', loaders: ['babel-loader?cacheDirectory=true'], threadPool: happyThreadPool, }), new HappyPack({
id:'happy-vue-loader', loaders:[{
loader:'vue-loader', cacheDirectory:true, options:vueLoaderConfig // 添加到了此处 }], threadPool: happyThreadPool, }), ], module:{
rules: [ {
test: /\.vue$/, //loader:'vue-loader', loader: 'happypack/loader?id=happy-vue-loader', // id 是很重要的属性。将vue-loader代理给happypack // options: vueLoaderConfig // 必须注释掉options,因为此时loader是happypack的 ,在rules里面写的话不会生效,并且报错,所以应该在happypack中添加options }, {
test: /\.js$/, //loader:'babel-loader', loader: 'happypack/loader?id=happy-babel-js', include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] }, ... ] }
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/178637.html原文链接:https://javaforall.net
