Canonical: https://www.startearly.ai/case-files/rspack/commonjs-default-export/
Updated: 2026-11-14

# Rspack CommonJS Default Export Case File | Early

## The build passed. The import failed at runtime.

Regression Case File

Rspack v2.1.0 production builds could remove the real default export from a Babel-compiled CommonJS package. The affected import worked in the release candidate, and v2.1.1 restored the behavior about 18 hours later.

## Release

**Baseline:** v2.1.0-rc.0

**Introduced:** v2.1.0

**Last Affected:** v2.1.0

**Restored:** v2.1.1

**Affected Release Count:** 1

### Public report

Reported by: User. Recorded report delay: 12 minute.

Recorded fix delay: 18 hours.

**Approximate:** true

## Regression

The production build completed.

The default import did not.

Valid default imports became undefined.

**Changed:** A new side-effect analysis treated a CommonJS export assignment inside an unused variable declaration as removable. Production optimization then discarded the declaration and the export write with it. Rspack v2.1.1 reverted the change.

**Relationship:** Babel-compiled CommonJS package → Rspack optimizer → production bundle → default import

Removing the unused declaration also removed the default export assignment that consumers needed.

## Replay

The recorded historical analysis compared v2.1.0-rc.0 with v2.1.0.

The run reported **4 Expected** and **1 Regression** findings.

“Expected” means behavior Early classified as expected, not the number of bugs it expected to find. “Regression” identifies behavior classified as a defect relative to the baseline. These labels describe this run; the counts are not recall or accuracy measurements. The verification evidence below establishes which defects were corroborated.

**Finding Title:** CJS export-assign now DCE-prunable via declarator

**Finding Summary:** Early traced the production-only failure to the changed side-effect analysis and the export write it made removable. The independent reproduction passed on v2.1.0-rc.0, failed on v2.1.0, and passed again on v2.1.1.

The actual Regression finding from the Early product.

### Public Report

[Public issue #14589](https://github.com/web-infra-dev/rspack/issues/14589)

### Introducing Change

[Introducing PR #14260](https://github.com/web-infra-dev/rspack/pull/14260)

### Upstream fix

[Upstream revert PR #14600](https://github.com/web-infra-dev/rspack/pull/14600)

**Disclosure:** Independent replay. Not affiliated with Rspack.

[Technical article](https://www.startearly.ai/post/rspack-cjs-export-regression-release-replay/)

## Source and next step

[Read the canonical page and its evidence](https://www.startearly.ai/case-files/rspack/commonjs-default-export/).
