我使用webpack
,在构建并运行chrome后显示此错误,我不知道如何解决它。
我的代码非常简单:
{
"devDependencies": {
"babel-core": "^6.23.1",
"babel-loader": "^6.3.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.22.0",
"babel-runtime": "5",
"css-loader": "^0.26.1",
"html-webpack-plugin": "^2.28.0",
"vue-hot-reload-api": "^2.0.9",
"vue-html-loader": "^1.2.3",
"vue-loader": "10.0.3",
"vue-style-loader": "^2.0.0",
"vue-template-compiler": "^2.1.10",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.1"
},
"dependencies": {
"vue": "^2.1.10"
}
}
答案 0 :(得分:11)
Vue是该库的默认导出,因此您可以像这样导入。
$ ./test
Equals
答案 1 :(得分:6)
您需要导入仅运行时版本。 This comment in the Github issues解释。
将其放入您的webpack.config.js
。
resolve: {
alias: {
vue: 'vue/dist/vue.js'
}
}