Skip to content

Fix resource paths to use relative ./ instead of absolute /#260

Merged
lyqht merged 7 commits intomainfrom
copilot/fix-relative-pathing
Apr 2, 2026
Merged

Fix resource paths to use relative ./ instead of absolute /#260
lyqht merged 7 commits intomainfrom
copilot/fix-relative-pathing

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

When deployed at a sub-path (e.g. domain.com/mini-qr/), all asset references broke because the default Vite base was /, generating absolute paths like /assets/index.js that assume domain-root deployment.

Changes

  • vite.config.js: Default base changed from '/''./'; simplified trailing-slash guard by removing redundant base !== '/' check
  • index.html: Static favicon/apple-touch-icon hrefs changed from /favicon.svg./favicon.svg etc.
  • src/utils/basePath.ts: Runtime fallback default updated from '/''./'
  • .env.example: Updated comment to reflect new default

Before → After (built index.html)

-<script type="module" crossorigin src="/assets/index-abc123.js"></script>
-<link rel="stylesheet" href="/assets/index-abc123.css">
+<script type="module" crossorigin src="./assets/index-abc123.js"></script>
+<link rel="stylesheet" href="./assets/index-abc123.css">

With BASE_PATH explicitly set (e.g. /mini-qr), behavior is unchanged.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mini-qr Ready Ready Preview, Comment Mar 31, 2026 0:43am

Copilot AI linked an issue Mar 31, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix incorrect relative pathing for resource loading Fix resource paths to use relative ./ instead of absolute / Mar 31, 2026
Copilot AI requested a review from lyqht March 31, 2026 12:45
@lyqht lyqht marked this pull request as ready for review April 2, 2026 01:40
@lyqht lyqht merged commit df6f2e6 into main Apr 2, 2026
4 checks passed
@lyqht lyqht deleted the copilot/fix-relative-pathing branch April 2, 2026 01:40
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.

Incorrect reletive pathing

2 participants