LiLian
LiLian

Reputation: 289

why my vue.app doesn't appear in the deploy version?

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. ›enter image description here

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

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.

Upvotes: 1

Views: 578

Answers (1)

Dan
Dan

Reputation: 63099

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/'
}

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/'
    : '/'
}

Upvotes: 1

Related Questions