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]: When buildCache is enabled, encountering lazy import paths or barrel files causes a panic at runtime #9605

Open
starrnx opened this issue Mar 9, 2025 · 2 comments
Assignees

Comments

@starrnx
Copy link

starrnx commented Mar 9, 2025

Version

System:
    OS: macOS 15.3.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 3.06 GB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 134.0.6998.45
    Edge: 134.0.3124.51
    Safari: 18.3
  npmPackages:

Details

I need buildCache to solve the performance issue of hot updates in my large source code project, and I encountered the following error:

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 dependency
Location: crates/rspack_core/src/cache/persistent/occasion/make/module_graph.rs:85

Reproduce link

https://github.com/starrnx/rslib-panic

Reproduce Steps

Running pnpm run dev will result in the following error. The error will be resolved if the source code does not contain barrel files or React lazy imports. I am not sure if there are other situations that could cause a crash.

Image
@Timeless0911
Copy link
Contributor

This seems to be a issue related to persistent cache when we use barrel file as entry. The simplest demo can only contain a.ts and barrel.ts.

Image

@Timeless0911 Timeless0911 transferred this issue from web-infra-dev/rslib Mar 10, 2025
@starrnx
Copy link
Author

starrnx commented Mar 10, 2025

@Timeless0911 Using import methods like React.lazy or react-loadable can also cause the same issue, not just barrel files.

const LazyComponent = React.lazy(() => import('./LazyComponent'));

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

No branches or pull requests

3 participants