使用的WebPack与Vue公司编译项目后,当我打开一个使用Vue的组件的页面,我得到:的WebPack无法装入Vue的组件
[Vue warn]: Failed to mount component: template or render function not defined.
,并在地方组件Vue呈现
<-- function (a, b, c, d) { return createElement(vm, a, b, c, d, true); } -->
为什么会发生此错误?
注:I've created an MCVE for this problem.使用的具体的WebPack配置为:
module.exports = {
entry: __dirname + '/display.js',
output: {
filename: 'bundle.js'
},
module: {
rules: [ { test: /\.vue$/, loader: 'vue-loader' } ]
}
}
尝试改变'常量的Vue =需要('VUE /距离/ vue.common.js ')'到'const Vue = require('vue')'。有关详细信息,请参阅https://github.com/vuejs/vue-router/issues/713和https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only。 – ceejayoz
这会导致'Vue不是构造函数'。我试过'dist'中的所有文件,但它们都不起作用。 – RedHatter
你是否考虑过通过'vue-cli'开始使用其中一个默认模板? https://github.com/vuejs/vue-cli – ceejayoz