记录一个uni-app上的碰到的问题
问题描述:
[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.
解决方案:
在项目下新增一个vue.config.js文件,文件内写入如下信息(如果你本来就这个文件,那么你看下我特别标注的两行是否都有):
const path = require("path");
module.exports = {
// webpack配置 - 简单配置方式
configureWebpack: {
resolve: {
alias: {
// 别名
vue$: "vue/dist/vue.esm.js", //加上这一句
// "@api": path.resolve(__dirname, "./src/api"),
// "@utils": path.resolve(__dirname, "./src/utils")
}
}
},
runtimeCompiler: true //加上这一句
}