First posted document cli.vuejs.org/zh/guide/de… If you upload dist without looking at the document, you’re basically getting a 404 or a blank page

The first step in publishing a VUE to Gitee is to change the path

  1. Set the correct publicPath in vue.config.js.

    If you plan to deploy your project to https://

    .github. IO /, publicPath will be set to “/” by default, and you can ignore this parameter.

    If you plan to deploy the project to https://

    .github. IO /

    / (that is, the repository address is https://github.com/

    /

    ), You can set publicPath to “/

    /”. For example, if the repository name is “my-project”, the contents of vue.config.js should look like this:




    module.exports = {
      publicPath: process.env.NODE_ENV === 'production'
        ? '/my-project/'
        : '/'
    }
    Copy the code

2. Add shell scripts and a new Dist repository to achieve automation

In the project directory, create deploy.sh with the following content (uncommented as appropriate) and run it to deploy

#! /usr/bin/env sh # Stop script when an error occurs set -e # build YARN build # CD dist # deploy to custom domain # echo 'www.example.com' > CNAME Git add. Git commit -m 'deploy' # https://<USERNAME>.github [email protected]:<USERNAME>/<USERNAME>.github.io. Git master # deploy to https://<USERNAME>.github. IO /<REPO> git push -f [email protected]:xmy16211127/test1.git master:gh-pages cd -Copy the code

Run the sh deploy.sh command on the terminal to run the deploy