yy2013年度盛典排名,金乡生活网,风野七咒txt下载
在使用 vue-cli3 build的时候,使用非子目录需要在 vue.config.js 中添加如下代码:
module.exports = { baseurl: process.env.node_env === 'production' ? '/dist/' : '/', }
但是build完后,放在nginx服务下,会看到如下报错,页面也显示 no-script 的内容
[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-router 是用了 history 模式,但是 nginx 并没有添加相应的配置便会出现这个问题。所以,如下解决方案:
1.变更生产环境配置,使得支持 history 模式。这里只需要修改 nginx 的配置,把 404 指向 即可。
2.不在使用history模式
总结
以上所述是小编给大家介绍的vue-cli3 使用子目录部署问题,希望对大家有所帮助
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
详解element上传组件before-remove钩子问题解决
vue.js中使用微信扫一扫解决invalid signature问题(完美解决)
网友评论