webpack - 您正在使用 Vue 的仅运行时构建,其中模板编译器不可用

标签 webpack vue.js

我正在尝试使用 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.jstrue:

module.exports = {
  runtimeCompiler: true
}

请注意,这会将额外的 JavaScript 负载包含到您的分发中。

或者,您可以使用预编译的 Vue 模板。

关于webpack - 您正在使用 Vue 的仅运行时构建,其中模板编译器不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47332728/

相关文章:

javascript - 通过 Babel 使用 Es2015 模块进行 Webpack 和 React

reactjs - 如何将 React 应用程序捆绑到服务器上的子目录中?

jQuery 与 WordPress 和 Webpack

javascript - 如何在 Vue.js 组件中使用外部 JS 文件中的数组?

javascript - 如何使用vue js追加元素

javascript - 在 <i18n> 标签中延迟加载翻译文件

reactjs - 在构建过程中呈现 Create React App html 模板的内容是什么

vue.js - Vuetify 输入自动完成错误

javascript - Vue.js 在计算值更新时添加类

javascript - Vue 未定义