I encountered an error after get off work
[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.
Based on the error prompt description and search to draw a conclusion:The vue compiled version introduced by the project is wrong
Solution 1
build/ and set the alias alias of vue, as follows:
resolve: { alias: { vue: 'vue/dist/' } }
Solution 2
Open src/modify Vue object initialization.
new Vue({ el: '#app', router, components: { App }, template: '<App/>' })
Change to
new Vue({ el: '#app', router, render: h => h(App) })
The reason is that using the template attribute requires the introduction of the full version with the compiler
If used in .vue file
<template> <div></div> </template> <script> export default { name:'name1', data() { return {}; } }; </script>
This form, then imported using import, does not require a full version, because the *.vue file will be automatically precompiled to js when using vue-loader.
In fact, there are clear statements on the official website of vuejs
Interpretation of different build versions (/v2/guide/#%E5%AF%B9%E4%B8%8D%E5%90%8C%E6%9E%84%E5%BB%BA%E7%89%88%E6%9C%AC%E7%9A%84%E8%A7%A3%E9%87%8A)
other