Skip to content

fix: #49 fix the bug of split chunks algorithm with rspack 2#50

Merged
xfsnowind merged 1 commit into
mainfrom
49-splitChunks-failure
Apr 13, 2026
Merged

fix: #49 fix the bug of split chunks algorithm with rspack 2#50
xfsnowind merged 1 commit into
mainfrom
49-splitChunks-failure

Conversation

@xfsnowind

@xfsnowind xfsnowind commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #49 — Disables splitChunks in the default Cypress rspack config to prevent module loading failures with Rspack v2 on Linux.

Problem

The splitChunks: { chunks: 'all' } setting (inherited from Cypress's official @cypress/webpack-dev-server) causes Rspack v2's chunk splitting algorithm to produce broken chunk boundaries on Linux. A transitive dependency gets placed in a separate chunk that hasn't loaded when the spec module evaluates, resulting in:

TypeError: Cannot read properties of undefined (reading 'call')
  at __webpack_require__

The issue is platform-specific — it reproduces on Linux (@rspack/binding-linux-x64-gnu) but not on macOS (@rspack/binding-darwin-arm64) with identical node_modules.

Why this fix is safe

Chunk splitting is not beneficial for Cypress component testing — all code runs in a single test iframe. There's no performance gain from shared vendor chunks in this context. The splitChunks config was inherited from Cypress's webpack-dev-server where it works correctly with webpack's chunk loading runtime, but Rspack v2's rewritten @rspack/dev-server (no longer based on webpack-dev-server) handles chunk loading differently.

Changes

  • src/makeDefaultRspackConfig.ts: splitChunks: { chunks: 'all' }splitChunks: false
  • dist/makeDefaultRspackConfig.js: same change in compiled output

@xfsnowind xfsnowind self-assigned this Apr 13, 2026
@xfsnowind xfsnowind force-pushed the 49-splitChunks-failure branch from aec8978 to 199a76d Compare April 13, 2026 07:14
@xfsnowind xfsnowind merged commit 081b3ff into main Apr 13, 2026
4 checks passed
@xfsnowind xfsnowind deleted the 49-splitChunks-failure branch April 13, 2026 07:15
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

Successfully merging this pull request may close these issues.

splitChunks: { chunks: 'all' } causes module loading failure on Linux with Rspack v2

1 participant