Skip to content

[Bug]: Page loads fail with "Chunk is from another build" after a module shared by the entry and an async chunk gains an export (2.3.1) #16542

Closed

Description

@Sheraff

Written by an AI coding agent (Claude) on behalf of a TanStack Router maintainer; reproduced locally.

System Info

System: Linux 6.12 x64 (Debian 13)
Binaries: Node 26.12.1, npm 12.2.0
npmPackages: @rspack/core 2.3.1, @rspack/cli 2.3.1, @rspack/dev-server 2.2.2
Browser: Chromium (Playwright 1.63.0)

Details

A module imported by both the entry and an async chunk gains an export. From then on, every page load is blank until the dev server restarts.

// rspack.config.mjs
import { rspack } from '@rspack/core'
export default { mode: 'development', entry: './src/index.js', plugins: [new rspack.HtmlRspackPlugin()] }
// src/format.js
export const label = (s) => s.toUpperCase()

// src/chunk.js
import { label } from './format.js'
export default () => label('chunk')

// src/index.js
import { label } from './format.js'
import('./chunk.js').then((m) => {
  document.body.textContent = label('app') + ' ' + m.default()
})

Actual: after appending export const added = 1 to src/format.js and reloading, the page is blank: GET /main.<hash>.hot-update.json 404, then Uncaught Error: Chunk is from another build, and no update leads to it. A new tab fails the same way, and so does every later load.

Expected: APP CHUNK, as before the edit.

@rspack/core result
2.3.1, canary 2.3.2-canary-8d4b11b4-20261108172652 blank page
2.3.0, 2.2.9, 2.2.0, 2.1.0, 2.0.0, 1.7.12 works
webpack 5.112.2 (same files) works

It needs the added export and the module shared by the entry and the chunk: a comment edit, or format.js imported only from chunk.js, works. Rsbuild 2.3.1 shows the same (with output.module, a 404 on index.<hash>.hot-update.json.mjs).

The error comes from the chunk version check added in #16360. Possibly related: #16315 (tracking: cross-build version consistency).

Reproduce link

https://github.com/Sheraff/rspack-chunk-version-after-new-export

Reproduce Steps

  1. npm install && npx playwright install chromium
  2. npm run repro: loads the page, appends the export, reloads; prints a blank page and the error, exits 1
  3. Control: npm install -D @rspack/core@2.3.0 && npm run repro prints OK

Manually: npm run dev, open the page, append export const added = 1 to src/format.js, reload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions