vue-cli3 注册 compent 报错 dogify vue 2020-03-17 3702 次浏览 30 次点赞 # 报错内容 >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 不包含模板编译器。考虑通过 render 函数编译模板,或使用包含编译器的版本。 在使用vue-cli 3创建一个项目后,使用Vue.compent创建组建时报告了上面的错误,错误原因如中文译文所示。 # 解决方案 参考了vue-cli官网的 [配置内容](https://cli.vuejs.org/zh/config/#runtimecompiler "配置内容")。在与package.json同级的文件夹创建一个vue.config.js的配置文件。 添加以下代码: ``` module.exports = { runtimeCompiler: true } ``` 重新运行 `npm run serve`即可。 本文由 dogify 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。 点赞 30
还不快抢沙发