-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Open
Labels
Description
Describe the bug
When a plugin marks a specifier as external by returning external: true
in resolveId
vite will fail to load the module in the ssr environment.
Reproduction
https://github.com/marvinhagemeister/deno-vite-ssr-external-bug
Steps to reproduce
- Clone https://github.com/marvinhagemeister/deno-vite-ssr-external-bug
- Install Deno https://docs.deno.com/runtime/getting_started/installation/
- Run
deno install
- Run
deno task dev
-> visit browser
System Info
System:
OS: macOS 15.6.1
CPU: (8) arm64 Apple M1
Memory: 99.59 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.8.0 - ~/.nvm/versions/node/v24.8.0/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 11.6.0 - ~/.nvm/versions/node/v24.8.0/bin/npm
pnpm: 10.12.4 - ~/Library/pnpm/pnpm
bun: 1.2.20 - ~/.bun/bin/bun
Deno: 2.5.2 - ~/.deno/bin/deno
Watchman: 2025.03.10.00 - /opt/homebrew/bin/watchman
Browsers:
Brave Browser: 138.1.80.125
Chrome: 140.0.7339.210
Chrome Canary: 137.0.7123.0
Safari: 18.6
Used Package Manager
npm
Logs
Click to expand!
$ deno task dev
Task dev vite --force
2:52:17 AM [vite] (client) Forced re-optimization of dependencies
VITE v7.1.7 ready in 688 ms
➜ Local: http://127.0.0.1:5173/
➜ Network: use --host to expose
➜ press h + enter to show help
2:52:18 AM [vite] (ssr) Error when evaluating SSR module ssr:entry: Failed to load url npm:preact (resolved id: npm:preact) in /Users/marvinhagemeister/dev/test/deno-vite/ssr.tsx. Does the file exist?
at loadAndTransform (file:///Users/marvinhagemeister/dev/test/deno-vite/node_modules/.deno/[email protected]_1/node_modules/vite/dist/node/chunks/dep-Bm2ujbhY.js:26109:33)
error: Uncaught (in promise) Error: Failed to load url npm:preact (resolved id: npm:preact) in /Users/marvinhagemeister/dev/test/deno-vite/ssr.tsx. Does the file exist?
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.