为什么我的vue.app没有出现在部署版本中? [英] why my vue.app doesn't appear in the deploy version?

查看:88
本文介绍了为什么我的vue.app没有出现在部署版本中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的vue.js项目部署到Github页面中.它适用于HTML,CSS,图像,但没有呈现出来.应用程序组件.呈现Vue的部分.应用程序消失.这是我的dis文件夹结构.›

I want to deploy my vue.js project into the Github page. It works well for HTML, CSS, image, but it didn't render the vue. app components. The part which shall render the vue. app disappear. Here is my dis folder structure. ›

这是我的git仓库: https://github.com/liulian1004/test .

And here is my git repo: https://github.com/liulian1004/test.

感谢您的帮助.我是Vue.js的初学者,这是我第一次部署vue项目.让我知道您是否需要更多信息.

Appreciate your help. I am a beginner for the Vue.js, and this is my first time to deploy the vue project. Let me know if you need more info.

推荐答案

由于不是从根目录提供应用程序,而是在/test 中提供服务,因此需要配置 publicPath vue.config.js 中:

Since you're not serving the app from the root directory, but in /test, you need to configure publicPath in vue.config.js:

module.exports = {
   publicPath: '/test/'
}

这是使用的条件 publicPath .env ,从 Vue CLI文档在开发和生产中都可以正常使用:

Here is a conditional publicPath using .env, from the Vue CLI docs which will allow you to serve it properly in both development and production:

module.exports = {
  publicPath: process.env.NODE_ENV === 'production'
    ? '/test/'
    : '/'
}

这篇关于为什么我的vue.app没有出现在部署版本中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆