Repository navigation
Closed
Copy link
Labels
Description
Describe the bug
With experimental.bundledDev: true and a non-root base (e.g. /web-packages), dynamic import() in dev requests:
/@vite/lazy?id=...&clientId=...
instead of:
/web-packages/@vite/lazy?id=...&clientId=...
Because the path omits config.base, Vite's base middleware returns 404 ("did you mean /web-packages/@vite/lazy?...").
Expected: lazy proxy URL is prefixed with base.
Actual: hardcoded /@vite/lazy without base.
Notes:
- Works with
base: '/' - Works if the URL is manually rewritten to include
/web-packages - Production (
vite build+vite preview) under the same non-rootbaseworks — dev-only
Reproduction
https://stackblitz.com/github/dark1451/issue-vite-bundleddev-base-lazy?file=vite.config.ts
Steps to reproduce
- Open the reproduction (or clone +
npm install+npm run dev) - Open http://localhost:5173/web-packages/ (StackBlitz: open preview under
/web-packages/) - Open DevTools → Network → filter
@vite/lazy - Click "Load lazy module"
- Observe
GET /@vite/lazy?...→ 404 - Open the same URL with
/web-packagesinserted after the origin → 200 - Set
base: '/'→ dynamic import works npm run build && npm run previewwithbase: '/web-packages'→ works
System Info
System:
OS: macOS 15.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 189.64 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.21.1 - /Users/theo/.nvm/versions/node/v22.21.1/bin/node
Yarn: 3.6.1 - /Users/theo/.nvm/versions/node/v22.21.1/bin/yarn
npm: 10.9.4 - /Users/theo/.nvm/versions/node/v22.21.1/bin/npm
pnpm: 10.9.0 - /Users/theo/.nvm/versions/node/v22.21.1/bin/pnpm
Browsers:
Chrome: 151.0.7922.108
Safari: 18.3
npmPackages:
@vitejs/plugin-react: ^6.0.4 => 6.0.5
vite: ^8.2.0 => 8.2.1Used Package Manager
npm
Logs
Click to expand!
# Network / terminal
GET /@vite/lazy?id=...&clientId=... → 404
# baseMiddleware suggests: /web-packages/@vite/lazy?...Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reacted by Benjamin Kindle, Matěj Kaška and Mathias Stang
Reacted by sandstrom
Activity
fix(playground): bundledDev lazy 임시 비활성화 (#64)
AbarnaaSree commentedon Aug 10, 2026
Hi, I’d like to investigate and work on this issue if no one is currently working on it. I can reproduce the problem with
experimental.bundledDev: trueand a non-rootbase, where the generated/@vite/lazyrequest misses the configured base path and results in a 404.Would it be okay for me to work on a fix and submit a PR?
h-a-n-a commentedon Aug 11, 2026
Yes! Go ahead! Thanks for the contribution
docs(dev/lazy): document how Vite serves lazy chunks under `base`
docs(dev/lazy): document how Vite serves lazy chunks under `base`
docs(dev/lazy): document how Vite serves lazy chunks under `base`
docs(dev/lazy): document how Vite serves lazy chunks under `base`
docs(dev/lazy): document how Vite serves lazy chunks under `base`
docs(dev/lazy): document how Vite serves lazy chunks under `base`
docs(dev/lazy): document how Vite serves lazy chunks under `base`
docs(dev/lazy): document how Vite serves lazy chunks under `base`
docs(dev/lazy): document how Vite serves lazy chunks under `base`
docs(dev/lazy): document how Vite serves lazy chunks under `base`
docs(dev/lazy): document how Vite serves lazy chunks under `base`