在执行npm run dev 时出现错误:_vueRouter2.default is not

在执行npm run dev时出现_vueRouter2.default is not a constructor

Uncaught 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


HUWWW
浏览 1833回答 1
1回答

侃侃无极

我的问题已经解决了,你看一下你的是不是也是这个原因。在webpack配置文件webpack.config.js文件中,config={}里面有一个参数是resolve:resolve: {&nbsp; &nbsp; &nbsp; alias: {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'vue$': 'vue/dist/vue.js'&nbsp; &nbsp; &nbsp; }&nbsp; },这里缺少vue-router,加进去即可。resolve: {&nbsp; &nbsp; &nbsp; alias: {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'vue$': 'vue/dist/vue.js',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'vue-router$': 'vue-router/dist/vue-router.common.js'&nbsp; &nbsp; &nbsp; }&nbsp; },
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript