How Deploy vue 3 (Vite) to github pages
- Set base to vite.config.js
export default defineConfig({
base:
process.env.NODE_ENV === "production"
? "/YOUR_PROJECT_NAME/" // production
: "/", // development
});
- Remove dist from .gitignore
- build project
npm run build
-
Make sure to commit & push origin master/main
-
Use subtree
git subtree push --prefix dist origin gh-pages
- Go to your project repo & open settings > pages > on Build and deployment branch change to gh-pages & save.
- Done. Visite site