Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support subpath deployment #252

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

berlysia
Copy link
Contributor

@berlysia berlysia commented Jan 11, 2025

fixes #243 partially

The problem occurs because the .js file references in each HTML are written as root-relative paths. If the deployment destination is a subpath (e.g., GitHub Pages), the subpath segment must be included when referencing root-relative paths.

When deploying to https://example.com/path/to/some/dir/, the following mismatch arises, causing the .js file to fail to load:

Reference in the output HTML Actual file path = Correct reference
/static/client-${hash}.js /path/to/some/dir/static/client-${hash}.js

This PR enables deployment to subpaths such as GitHub Pages. See https://vite.dev/config/shared-options#base https://vite.dev/guide/env-and-mode#env-variables

@berlysia berlysia changed the title test: subpath deployment Support subpath deployment Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support "base" config of Vite or alternatives
1 participant