Skip to content

feat(bundler)!: migrate to Rspack 2 - #116

Merged
atldays merged 3 commits into
developfrom
feature/rspack-2
Oct 29, 2026
Merged

atldays merged 3 commits into
developfrom
feature/rspack-2

Conversation

@atldays

@atldays atldays commented Oct 29, 2026

Copy link
Copy Markdown
Member

Changes

Upgrade to Rspack ~2.2.9 and @rsdoctor/core, adapting isolated CSS loading to the new runtime and updating emitted text assets through RawSource and compilation.updateAsset. Fail the build with a diagnostic if the expected CSS runtime changes.

Set source-map defaults explicitly, preserve project-root resolution for root-relative CSS and SCSS URLs, and keep missing value exports as errors while tolerating type re-exports from TypeScript modules compiled by SWC.

Migrate Jest to native ESM while retaining real compiler and loader coverage and Node.js 22.12 support. Publish selective-split watch fixture state atomically to prevent partially written JSON from causing intermittent failures.

Breaking changes

  • Custom bundler plugins must support the ESM-only Rspack 2 API.
  • Development builds emit external .map files instead of eval wrappers unless a plugin overrides the configuration. Watch source maps remain inline.
  • Missing value exports fail the build. Use valid named exports, or a side-effect import for a ?asis module.
  • Re-export package types explicitly, for example export type {UserConfig} from "adnbn"; the bundler cannot infer type-only exports from package .d.ts files.
  • The built-in SWC loader no longer reads .swcrc; supply required options through the framework plugin's builtin:swc-loader configuration.

Validation

  • Pre-push checks passed: package build, framework typecheck, fixture builds/typechecks, and all 219 non-browser suites / 2531 tests.
  • Migration was validated locally on Node.js 22.12 and 24, including browser integrations.
  • Selective-split watch stress validation passed 20/20 runs across Node.js 22.12 and 24.5 with four concurrent processes.
  • Integration coverage includes local/package type re-exports, missing value exports, root-relative CSS/SCSS URLs, source-map defaults and overrides, and execution of the isolated CSS runtime.

The three commits separate Jest infrastructure, the Rspack migration, and the watch-test race fix.

Run Jest through the shared ESM wrapper and convert module mocks, raw templates
and test paths to native ESM. Load the configuration from jest.config.mjs and
use the built private style loader so build tests also work on Node 22.12.

Remove the storage resolver workaround, the CJS style-loader substitute and
the unused ts-node dependency. Keep the background finder doubles local to
their tests and document the test runner requirements.

Preserve coverage with real Rspack and loaders. Validate the migration against
Rspack 1.7 before upgrading the bundler, then check Node 22.12 and Node 24.
Upgrade Rspack to ~2.2.9 and replace the Rsdoctor integration with @rsdoctor/core.
Adapt isolated CSS loading to the new runtime and update emitted text assets
through RawSource and compilation.updateAsset.

Set development builds to cheap-module-source-map and production builds to
devtool: false before applying plugin configuration. Keep watch source maps
inline. Preserve project-root resolution for root-relative CSS and SCSS URLs.

Keep missing exports as build errors in the base bundler configuration. Collect
TypeScript export metadata and use tolerant type re-export validation for
TypeScript modules compiled by the built-in SWC loader.

Cover local and package type re-exports, missing value exports, CSS and SCSS
root-relative URLs, source map defaults and plugin overrides with integration
tests. Verify the isolated CSS runtime and preserve Jest support on Node 22.12.

BREAKING CHANGE: Builds now use the ESM-only Rspack 2 API. Custom bundler plugins
must support Rspack 2. Development builds emit external .map files instead of
eval wrappers unless overridden through bundler configuration. Missing value
exports now fail the build; use named exports that exist, or a side-effect
import for a ?asis module. Re-export types from packages that ship JavaScript
and .d.ts declarations with explicit export type, for example:
export type {UserConfig} from "adnbn". The bundler cannot infer these type-only
exports from package declarations. The built-in SWC loader no longer reads .swcrc;
move required SWC options into the builtin:swc-loader configuration supplied
by a framework plugin. The supported Node.js minimum remains 22.12.0.
Write selection JSON to a sibling temporary file and rename it into place so
watchRun cannot parse the empty or partial contents of an in-progress write.
Preserve the stale-result scenario and every isolation transition assertion.

Reproduce the partial-write failure deterministically and verify the same
interleaving after the fix. Pass 20 runs across Node 22.12 and Node 24 with
four concurrent processes, related style-routing tests and typechecking.
@atldays
atldays merged commit 352e33e into develop Oct 29, 2026
24 checks passed
@atldays
atldays deleted the feature/rspack-2 branch October 29, 2026 12:02
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.

1 participant