webpack 默认不能处理vue文件,需要安装对应的load才可以
npm install vue-loader vue-template-compiler --save-dev
2.修改webpack.config.js
module: { rules: [ ...... { test: /.vue$/, use: { loader: 'vue-loader', } } ] }
再次打包依然报错
ERROR in
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
可能是因为vue-router 版本是15以上引起的
需要在webpack.config.js中添加如下配置
const VueLoaderPlugin = require('vue-loader/lib/plugin'); module.exports = { plugins: [ //插件配置 new VueLoaderPlugin() ], module: { ...... } };