關于webpack4.0+以上版本 npm run build 報錯問題的解決
關于版本升級的報錯,解決代碼如下(webpack.config.js 頁面,增加2處代碼):
const?path?=?require('path')
//此處
const?VueLoaderPlugin?=?require('vue-loader/lib/plugin')
module.exports?=?{
????entry:?path.join(__dirname,'src/index.js'),
????output:?{
????????filename:?"bundle.js",
????????path:?path.join(__dirname,'dist'),
????},
????module:{
????????rules:?[
????????????{
????????????????test:?/\.vue$/,
????????????????loader:?'vue-loader'
????????????},
????????????{
????????????????test:?/\.css$/,
????????????????use:?[
????????????????????'style-loader',
????????????????????'css-loader'
????????????????]
????????????}
????????]
????},
????//此處
????plugins:?[
????????new?VueLoaderPlugin()
????]
}
2018-11-10
我的webpack用的是4.0+版本,請問下為啥會報Cannot find module 'webpack'錯誤,我將node_modules下面的webpack刪除重新使用npm install webpack-dev-server指令安裝也還是報這個錯誤...
2018-11-09
https://blog.csdn.net/yangluan999/article/details/79980275? 根據這篇文章的配置搞定了
2018-11-08
const?path?=?require('path') const?VueLoaderPlugin?=?require('vue-loader/lib/plugin') module.exports?=?{ ????entry:?path.join(__dirname,'src/index.js'), ????output:?{ ????????filename:?"bundle.js", ????????path:?path.join(__dirname,'dist'), ????}, ????module:{ ????????rules:?[ ????????????{ ????????????????test:?/\.vue$/, ????????????????loader:?'vue-loader' ????????????}, ????????????{ ????????????????test:?/\.css$/, ????????????????use:?[ ????????????????????'style-loader', ????????????????????'css-loader' ????????????????] ????????????} ????????] ????}, ????plugins:?[ ????????new?VueLoaderPlugin() ????] }當然了,也可以下載指定webpack指定版本: