Skip to content

[Bug]: CSS extract build fails on Linux runners with duplicated build-time module ids #14701

Description

@hpoepping

System Info

System:
OS: Linux 6.11 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
CPU: (4) x64 Intel(R) Core(TM) i7-5930K CPU @ 3.50GHz
Memory: 3.15 GB / 3.82 GB
Container: Yes
Shell: 5.1.4 - /bin/bash
Binaries:
Node: 24.18.0 - /usr/local/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 11.16.0 - /usr/local/bin/npm

@rspack/core >= 2.1.0

Details

Problem

After upgrading from Rspack 2.0.8 to 2.1.0, CSS builds started failing on some Linux GitLab runners when using Rsbuild 2.

The issue can be reproduced with a minimal project created via npm create rsbuild@latest. Even importing an empty .scss/CSS file can trigger the failure.

Error

error Build error:
File: ./src/components/app.scss:1:1
× Module build failed (from ./node_modules/@rspack/core/dist/cssExtractLoader.js):
╰─▶ × Cannot read properties of undefined (reading 'build time')

Image

Investigation

The crash happens during executeModule for CSS extraction. The JS layer tries to access:
codegenResults.map[id]["build time"]
but id does not exist in the codegen results map.
Native diagnostics showed that the generated CSS module code contained duplicated build-time module ids, for example:
webpack_require("javascript/dynamic|.../noSourceMaps.jsjavascript/dynamic|.../noSourceMaps.js")
while the actual codegen result key only existed once:
javascript/dynamic|.../noSourceMaps.js
This means the issue is not caused by the JS execute-layer lookup itself, but by native code generation rendering an invalid module id expression.

Environment

-Rspack/Rsbuild regression between 2.0.8 and 2.1.0
-Reproduced on Linux GitLab runners
-Affected CSS extraction / cssExtractLoader
-Could not reproduce locally on Windows/macOS or Windows Docker
-Runner cache was cleared and did not affect the issue

Expected behavior

CSS extraction should render valid build-time module ids and the build should complete successfully.

Reproduce link

https://github.com/hpoepping/rsbuild-css-test

Reproduce Steps

  1. npm create rsbuild@latest
  2. npm run build (via GitLab CI/CD)

I have not been able to reproduce the issue outside of GitLab CI/CD yet.

Metadata

Metadata

Assignees

Labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions