Fix GitHub Pages 404s by setting correct base path for production builds#12
Fix GitHub Pages 404s by setting correct base path for production builds#12
Conversation
- Update Vite config to use /eagle-plugin-mini-map/ base for production - Update mock URLs to use import.meta.env.BASE_URL - Copy test fixtures to public during build for preview - Add public/tests to .gitignore Co-authored-by: lawvs <18554747+lawvs@users.noreply.github.com>
Replace cp command with copyfiles package for Windows compatibility Co-authored-by: lawvs <18554747+lawvs@users.noreply.github.com>
|
@copilot no need copyfiles, just use For vite config, remove the |
- Replace hardcoded base path with VITE_BASE_PATH env var - Fallback to "./" (relative) when env var not set - Replace copyfiles with native cp command - Remove copyfiles dependency Co-authored-by: lawvs <18554747+lawvs@users.noreply.github.com>
Done in commit c20fdf1. Changes:
To configure the GitHub Actions workflow, add this to your build step in - name: Build
run: pnpm run build
env:
VITE_BASE_PATH: /eagle-plugin-mini-map/This will set the base path for production builds while keeping local development and Eagle plugin builds using relative paths. |
|
@copilot Goods, add this to your build step in .github/workflows/build.yml:
|
1 similar comment
|
@copilot Goods, add this to your build step in .github/workflows/build.yml:
|
Set VITE_BASE_PATH=/eagle-plugin-mini-map/ for production builds Co-authored-by: lawvs <18554747+lawvs@users.noreply.github.com>
GitHub Pages deployment at
https://www.waterwater.moe/eagle-plugin-mini-map/was returning 404s for fixture URLs. Absolute paths like/tests/fixtures/...were missing the/eagle-plugin-mini-map/repository prefix.Changes
Vite base path (
vite.config.ts)VITE_BASE_PATHenvironment variable for configurable base path"./"(relative) when env var is not setDynamic mock URLs (
src/eagle/mock.ts)/tests/fixtures/...withimport.meta.env.BASE_URL + 'tests/fixtures/...'Build process (
package.json)cp -rcommand to copy test fixtures topublic/before Vite buildpublic/teststo.gitignore(build artifact)GitHub Actions workflow (
.github/workflows/build.yml)VITE_BASE_PATHenvironment variable to the Build step/eagle-plugin-mini-map/for production buildsResult: URLs resolve correctly as
https://www.waterwater.moe/eagle-plugin-mini-map/tests/fixtures/...when deployed to GitHub Pages, while maintaining relative paths for local development and Eagle plugin usage.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.