我正在尝试使用 webpack
编译我的 Vue.js 应用程序,但我在浏览器中收到此警告。
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.
这是什么意思?如何解决错误?
最佳答案
如果您尝试使用非预编译的 Vue 模板,则会弹出此错误。
要解决此问题,请设置 runtimeCompiler
option in vue.config.js
为 true
:
module.exports = {
runtimeCompiler: true
}
请注意,这会将额外的 JavaScript 负载包含到您的分发中。
或者,您可以使用预编译的 Vue 模板。
关于webpack - 您正在使用 Vue 的仅运行时构建,其中模板编译器不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47332728/