Skip to content

Conversation

@stormslowly
Copy link
Contributor

@stormslowly stormslowly commented Jan 10, 2026

Problem

remove-dynamic-entry-with-loader

Panic during E2E testing

Message: should set in compilation first
Location: crates/rspack_core/src/utils/deref_option.rs:52

Root Cause Analysis

The problem occurs as follows:

  1. The compiler completes the first compilation.
  2. The test case asserts successfully, then modifies the file's content, triggering a page.reload.
  3. This modification triggers a new compilation while the DerefOption<build_module_graph_artifact> is being executed.
  4. The page.reload initiates a new HMR (Hot Module Replacement) connection to the development server. The server sends stats to the new HMR client, which triggers a stats.toJson() call that requires the module graph.
  5. A panic occurs because the module graph is taken away.

Solution

  1. Configure a single runtime chunk to use HMR for reloading the page once the compilation is completed.
  2. Remove the page.reload in the test to avoid race conditions.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link

netlify bot commented Jan 10, 2026

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 07e4398
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6961ab86b7f8020008769cb3

@github-actions github-actions bot added release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack. labels Jan 10, 2026
@github-actions
Copy link
Contributor

📦 Binary Size-limit

Comparing 07e4398 to feat: add requireAlias option to control require variable renaming (#12686) by harpsealjs

🙈 Size remains the same at 47.88MB

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 10, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing test/fix_flaky_dynamic_entry_by_loader (07e4398) with main (6ee0d4b)

Summary

✅ 16 untouched benchmarks
⏩ 1 skipped benchmark1

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@github-actions
Copy link
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Change
react-10k 5.7 MB 0
react-1k 825.4 KB 0
react-5k 2.7 MB 0
ui-components 2.1 MB 0
rome 984.3 KB 0

Generated by Rsdoctor GitHub Action

@stormslowly stormslowly requested a review from hardfist January 11, 2026 18:09
@stormslowly stormslowly marked this pull request as ready for review January 11, 2026 18:09
Copilot AI review requested due to automatic review settings January 11, 2026 18:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a flaky E2E test that was causing panics due to a race condition between page reload and HMR connection during compilation. The test was attempting to call stats.toJSON() while the module graph was being updated during hot module replacement, resulting in a panic.

Changes:

  • Added runtimeChunk: 'single' optimization to ensure HMR uses a single runtime chunk
  • Removed manual page.reload() call and replaced with direct HMR-based assertion to eliminate the race condition

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/e2e/cases/make/remove-dynamic-entry-with-loader/rspack.config.js Added runtimeChunk: 'single' optimization to enable proper HMR handling
tests/e2e/cases/make/remove-dynamic-entry-with-loader/index.test.ts Replaced manual page reload with direct toContainText assertion that relies on HMR

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@stormslowly stormslowly merged commit a4152c5 into main Jan 12, 2026
90 of 92 checks passed
@stormslowly stormslowly deleted the test/fix_flaky_dynamic_entry_by_loader branch January 12, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants