`vp dev` with `experimental.bundledDev` fails on startup: Cannot find package 'rolldown'
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- Ein halber Tag
- Anfängerfreundlichkeit
- 78/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- javascript, node.js, typescript
- Bereich
- build-system, devtools
Rechercherichtung
Start with packages/core/build.ts, where bundled development paths are rewritten, and inspect the code around BUNDLED_DEV_CLIENT_ENTRY and ROLLDONE_DEV_RUNTIME_ENTRY. Reproduce with the command_dev_bundled_dev fixture, then verify that vp dev starts, serves /@rolldown/experimental-runtime.mjs, and the client imports the bundled runtime. The relevant existing packaged runtime is dist/rolldown/experimental-runtime.mjs; update the snapshot while ensuring unrelated installed rolldown packages are not used.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
On 1.3.0, vp dev with experimental.bundledDev: true exits on startup with ERR_MODULE_NOT_FOUND for rolldown.
vitejs/vite#23568 changed bundled dev to read the rolldown dev runtime from the installed rolldown package:
const ROLLDOWN_DEV_RUNTIME_ENTRY = "rolldown/experimental/runtime";
function rolldownDevRuntimeEntryPath() {
return fileURLToPath(import.meta.resolve(ROLLDOWN_DEV_RUNTIME_ENTRY));
}
That works in Vite, which depends on rolldown. @voidzero-dev/vite-plus-core bundles rolldown under its own ./rolldown/* exports and has no rolldown dependency, so the bare specifier doesn't resolve. If another package in the project happens to install rolldown, the resolve succeeds but picks up that copy's runtime, which may not match the bundled rolldown.
This is like #2384: a path in the upstream bundled-dev code that the core build doesn't rewrite for the packaged layout.
The runtime is already in the package as ./rolldown/experimental/runtime (dist/rolldown/experimental-runtime.mjs, which has no imports of its own). Resolving that export instead fixes it. We're running this patch locally:
function rolldownDevRuntimeEntryPath() {
- return fileURLToPath(import.meta.resolve(ROLLDOWN_DEV_RUNTIME_ENTRY));
+ return fileURLToPath(import.meta.resolve("@voidzero-dev/vite-plus-core/rolldown/experimental/runtime"));
}
ROLLDOWN_DEV_RUNTIME_ENTRY should keep its upstream value, because getHmrImplementation also uses it to find and rewrite the import in bundledDevClient.mjs. With the patch, vp dev starts, /@rolldown/experimental-runtime.mjs is served, and the client imports it.
A proper fix would probably rewrite the specifier in packages/core/build.ts alongside BUNDLED_DEV_CLIENT_ENTRY. The command_dev_bundled_dev snapshot from #2384 should catch it as long as no other package installs rolldown.
Reproduction
Any project on [email protected] with experimental: { bundledDev: true } in vite.config.ts and no rolldown package installed. The command_dev_bundled_dev fixture from #2384 should show it.
Steps to reproduce
- Create a project with
[email protected]. - Set
experimental: { bundledDev: true }invite.config.ts. - Run
vp dev.
System Info
macOS (Darwin 27.0.0, arm64)
Node 24.22.0
vite-plus 1.3.0 / @voidzero-dev/vite-plus-core 1.3.0
Vitest 5.0.5
Used Package Manager
yarn (4.18.1, node-modules linker)
Logs
error when starting dev server:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'rolldown' imported from /…/node_modules/vite/dist/vite/node/chunks/node.js
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:331:9)
at packageResolve (node:internal/modules/esm/resolve:784:25)
at moduleResolve (node:internal/modules/esm/resolve:873:18)
at defaultResolve (node:internal/modules/esm/resolve:1006:11)
at #cachedDefaultResolve (node:internal/modules/esm/loader:705:20)
at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:725:38)
at ModuleLoader.resolveSync (node:internal/modules/esm/loader:763:56)
at Object.resolve (node:internal/modules/esm/initialize_import_meta:37:25)
at rolldownDevRuntimeEntryPath (file:///…/node_modules/vite/dist/vite/node/chunks/node.js:21927:35)
at file:///…/node_modules/vite/dist/vite/node/chunks/node.js:21924:293 {
code: 'ERR_MODULE_NOT_FOUND'
}
- Vorherrschende Sprache
- Rust
- Sterne
- 6.3k
- Forks
- 283
- Ø Merge
- 1 T. 16 Std.
- Gemergte PRs (30 T.)
- 214
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus voidzero-dev/vite-plus
-
pending triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
voidzero-dev/vite-plus#2882 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
voidzero-dev/vite-plus#2097 · 10 Kommentare · 2 Reaktionen ·
Maintainer antworten meist innerhalb von 1 Tag
-
defineConfig drops own properties of Promise plugins (breaks Vike discovery)Evtl. vergeben @liangmiQwQ hat das heute übernommen. Offenbug
voidzero-dev/vite-plus#3152 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
vpx: watch reports for `vpx --watch`, and `vpx watch` on oxc-node's watcherEvtl. vergeben @fengmk2 hat das heute übernommen. Offen
voidzero-dev/vite-plus#3141 · 1 Reaktion · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Document cross-platform `FOO=bar cmd` in task commands and scriptsEvtl. vergeben @hyunbinseo hat das heute übernommen. Offendocumentation
voidzero-dev/vite-plus#3140 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in voidzero-dev/vite-plus
Ähnliche Issues
-
area: supply-chain
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 73/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
-
Refresh stale docsOffen
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 67/100
OpenCarControls/firmware#35 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag