Skip to content
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

HMR API doesn't work with ssrLoadModule #7887

Closed
7 tasks done
Rich-Harris opened this issue Apr 24, 2022 · 3 comments · Fixed by #12165
Closed
7 tasks done

HMR API doesn't work with ssrLoadModule #7887

Rich-Harris opened this issue Apr 24, 2022 · 3 comments · Fixed by #12165

Comments

@Rich-Harris
Copy link
Contributor

Describe the bug

If a module loaded with ssrLoadModule is invalidated, it is evicted from the module graph but isn't cleaned up. If it's subsequently loaded again, any resources created in the old module (websocket servers, timeouts, etc) will stick around, causing issues like sveltejs/kit#2903.

Ideally, I think the HMR API would apply to ssrLoadModule as well as modules loaded in the browser.

Reproduction

https://github.com/Rich-Harris/vite-ssr-hmr-repro

System Info

System:
    OS: macOS 12.0.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 278.28 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.1/bin/yarn
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
  Browsers:
    Chrome: 100.0.4896.127
    Firefox: 99.0.1
    Safari: 15.1
  npmPackages:
    vite: ^2.9.5 => 2.9.5

Used Package Manager

pnpm

Logs

No response

Validations

@sapphi-red

This comment was marked as resolved.

@Rich-Harris

This comment was marked as resolved.

@sapphi-red

This comment was marked as resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants