今天在尝试vuex官网上的列子时,发现控制台报如下错误:
[Vue warn]: You are using the runtime-only build of Vue where the
template compiler is not available. Either pre-compile the templates
into render functions, or use the compiler-included build.
后来通过百度发现,原因是vuex默认引入的文件不对,进行如下更改即可
module.exports = {
// 省略...
resolve: {
alias: {
'vue': 'vue/dist/vue.js'
}
},
...
至于其中具体的原理可以参考这篇博文。