Skip to content

module runner full reload error when importing node_modules dependency as entry #19975

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

Open
7 tasks done
hi-ogawa opened this issue May 1, 2025 · 0 comments
Open
7 tasks done
Labels
feat: ssr p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@hi-ogawa
Copy link
Collaborator

hi-ogawa commented May 1, 2025

Describe the bug

I use my own package as module runner entry server.environments.ssr.runner.import("my-package"), but this causes an error on full reload hi-ogawa/vite-plugins#742.

Here is a minimal repro:

$ node repro.js
[vite] connected.
[TEST] file:///home/projects/github-5yembwxu/node_modules/.pnpm/file+fixtures+test-dep/node_modules/test-dep/index.js
[vite] program reload
[vite] An error happened during full reload
Failed to load url test-dep.js (resolved id: test-dep.js). Does the file exist?
Error: Failed to load url test-dep.js (resolved id: test-dep.js). Does the file exist?
    at loadAndTransform (file:///home/projects/parigpvogv.github/node_modules/.pnpm/vite@6.3.4/node_modules/vite/dist/node/chunks/dep-Bn81Esdm.js:35788:17)

Now that #19283 is fixed, this can be worked around by wrapping entry with a virtual module, but I suspect there's still minor resolution issue around module runner and fetchModule.

Reproduction

https://stackblitz.com/edit/github-5yembwxu?file=repro.js

Steps to reproduce

open stackblitz

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    vite: ^6.3.4 => 6.3.4

Used Package Manager

pnpm

Logs

No response

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: ssr p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

1 participant