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

[Bug]: crash when using watching.invalidate in middleware which is apply in setupMiddlewares #8082

Open
Godsleeper opened this issue Oct 10, 2024 · 2 comments
Assignees
Labels
bug Something isn't working need reproduction

Comments

@Godsleeper
Copy link

System Info

System:
OS: macOS 15.0
CPU: (14) x64 Apple M3 Max
Memory: 773.21 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
Browsers:
Chrome: 129.0.6668.91
Safari: 18.0
npmPackages:
@rspack/cli: ^1.0.8 => 1.0.8
@rspack/core: ^1.0.8 => 1.0.8
@rspack/dev-server: ^1.0.7 => 1.0.7

Details

ERROR MESSAGE
Panic occurred at runtime. Please file an issue on GitHub with the backtrace below: https://github.com/web-infra-dev/rspack/issues
Message: should have event sender
Location: ./crates/rspack_core/src/compiler/module_executor/mod.rs:179

Backtrace omitted.

devServer will crash when using watching.invalidate.
works ok in my original webpack code for five years,how can I transform to rspack?

Reproduce link

No response

Reproduce Steps

DEMO Example
add this code

new RspackDevServer({
 setupMiddlewares(middlewares, devServer) {
     const clientWatcher = devServer.middleware.context.watching;
     middlewares.push((req, res, next) => {
          clientWatcher.invalidate(() => {
          next();
       })
    })
    return middlewares;
   }, clientWater);
}
@Godsleeper Godsleeper added bug Something isn't working pending triage The issue/PR is currently untouched. labels Oct 10, 2024
@LingyuCoder LingyuCoder self-assigned this Oct 17, 2024
@LingyuCoder
Copy link
Collaborator

Tried to reproduce the problem but failed. Could you provide a complete repro?

@LingyuCoder LingyuCoder added need reproduction and removed pending triage The issue/PR is currently untouched. labels Oct 18, 2024
Copy link
Contributor

Hello @Godsleeper, sorry we can't investigate the problem further without reproduction demo, please provide a repro demo by forking rspack-repro, or provide a minimal GitHub repository by yourself. Issues labeled by need reproduction will be closed if no activities in 14 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need reproduction
Projects
None yet
Development

No branches or pull requests

2 participants