在执行npm run dev时出现_vueRouter2.default is not a constructorUncaught TypeError: _vueRouter2.default is not a constructor at Object.eval (eval at <anonymous> (build.js:1195), <anonymous>:64:14) at eval (eval at <anonymous> (build.js:1195), <anonymous>:93:30) at Object.<anonymous> (build.js:1195) at __webpack_require__ (build.js:654) at fn (build.js:84) at Object.<anonymous> (build.js:1989) at __webpack_require__ (build.js:654) at build.js:701 at build.js:704
1 回答
侃侃无极
TA贡献2051条经验 获得超10个赞
我的问题已经解决了,你看一下你的是不是也是这个原因。
在webpack配置文件webpack.config.js文件中,config={}里面有一个参数是resolve:
resolve: {
alias: {
'vue$': 'vue/dist/vue.js'
}
},
这里缺少vue-router,加进去即可。
resolve: {
alias: {
'vue$': 'vue/dist/vue.js',
'vue-router$': 'vue-router/dist/vue-router.common.js'
}
},
添加回答
举报
0/150
提交
取消