Fix regressions after rsbuild v2#6987
Open
jpggvilaca wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the application/ui Rsbuild/Rspack configuration to address development-time regressions introduced after upgrading to rsbuild v2 (notably noisy OpenCV __dirname mock warnings, and async chunk naming issues that break web worker loading).
Changes:
- Adjust Rspack
nodemocking for__dirname/__filenameto avoid repeated build warnings while keeping equivalent browser runtime behavior. - Force deterministic chunk IDs in development to keep worker-related async chunk URLs consistent and prevent dev-server SPA fallback from serving
index.htmltoimportScripts. - Change dev-server
Cache-Controlheader from immutable caching tono-cacheto avoid stale chunk/HMR runtime URLs after rebuilds.
⏱️ Backend import time —
|
| Accelerator | Cumulative (s) | Self (s) |
|---|---|---|
cpu |
4.717 | 0.003 |
cuda |
4.596 | 0.003 |
xpu |
4.461 | 0.003 |
📊 Test coverage report
|
🐳 Docker image sizes
|
dwesolow
reviewed
Jul 7, 2026
| // browser opencv takes the non-Node code path, so the mock value | ||
| // is never used — switch to 'mock' to keep the (identical) runtime | ||
| // behavior without the noisy build warning. | ||
| node: { ...config.node, __dirname: 'mock', __filename: 'mock' }, |
Contributor
There was a problem hiding this comment.
Could we ignore the warnings from opencv? I think that might be safe because of:
// The vendored @geti/smart-tools OpenCV.js build (Emscripten-generated,
// cloned in by clone-geti-ui-packages and not ours to edit) contains
// __dirname/__filename in its Node-environment-detection boilerplate.
// It's dead code in a web build (guarded by an ENVIRONMENT_IS_NODE
// check) but Rspack still statically parses and warns on it. Scope
// the suppression to just this file so any future first-party/new
// dependency __dirname usage still surfaces a warning.
ignoreWarnings: [...(config.ignoreWarnings ?? []), { module: /smart-tools[\\/]src[\\/]opencv/ }]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
location.reloadis not a functionopencvmocking warningHow to test
Checklist