feat!: upgrade Rsbuild to v2 and deprecate experiments.advancedEsm#1513
Merged
feat!: upgrade Rsbuild to v2 and deprecate experiments.advancedEsm#1513
experiments.advancedEsm#1513Conversation
Deploying rslib with
|
| Latest commit: |
a1fbb85
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3401eab6.rslib.pages.dev |
| Branch Preview URL: | https://rsbuild-v2.rslib.pages.dev |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR upgrades the repo to Rsbuild v2 (@rsbuild/core@2.0.0-beta.7), aligns @rslib/core behavior with Rsbuild 2 defaults (notably ESM output + CSS pipeline), and deprecates lib.experiments.advancedEsm as a no-op.
Changes:
- Upgrade
@rsbuild/coreto2.0.0-beta.7across packages, examples, and test fixtures; adjust test expectations for new output behavior. - Deprecate/remove
experiments.advancedEsmusage in config composition, docs, CI lanes, and integration tests. - Update library build internals (format composition, entry chunk handling, CSS extract integration) to match Rsbuild/Rspack v2 behavior.
Reviewed changes
Copilot reviewed 79 out of 92 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| website/package.json | Pin website to Rsbuild v2 beta. |
| website/docs/zh/config/lib/format.mdx | Remove advanced ESM note; update IIFE library type to module. |
| website/docs/zh/config/lib/experiments.mdx | Document advancedEsm deprecation and version history. |
| website/docs/en/config/lib/format.mdx | Remove advanced ESM note; update IIFE library type to module. |
| website/docs/en/config/lib/experiments.mdx | Document advancedEsm deprecation and version history. |
| tests/scripts/shared.ts | Remove ADVANCED_ESM branching; export BuildResult type. |
| tests/package.json | Drop advanced ESM test script; bump Rsbuild v2 beta. |
| tests/integration/worker/package.json | Set fixture package to ESM (type: module). |
| tests/integration/vue/index.test.ts | Skip Vue ESM suite; refactor to beforeAll and shared results. |
| tests/integration/umd/rslibBundleFalse.config.mts | Add MTS config fixture for UMD bundle=false case. |
| tests/integration/umd/rslib.config.mts | Add MTS config fixture for UMD baseline. |
| tests/integration/umd/index.test.ts | Point bundle=false test to .mts config. |
| tests/integration/umd-library-name/rslib.config.mts | Add UMD name fixtures (string + array). |
| tests/integration/umd-globals/rslib.config.mts | Add externals/globals fixture for UMD. |
| tests/integration/style/tailwindcss/bundle/package.json | Set fixture package to ESM (type: module). |
| tests/integration/style/tailwindcss/bundle-false/package.json | Set fixture package to ESM (type: module). |
| tests/integration/style/sass/bundle/package.json | Set fixture package to ESM (type: module). |
| tests/integration/style/sass/bundle-false/package.json | Set fixture package to ESM (type: module). |
| tests/integration/style/postcss/bundle/package.json | Set fixture package to ESM (type: module). |
| tests/integration/style/postcss/bundle-false/package.json | Set fixture package to ESM (type: module). |
| tests/integration/style/lightningcss/bundle/package.json | Set fixture package to ESM (type: module). |
| tests/integration/style/lightningcss/bundle-false/package.json | Set fixture package to ESM (type: module). |
| tests/integration/style/css-modules-named/index.test.ts | Remove ADVANCED_ESM branching; unify snapshot. |
| tests/integration/shims/index.test.ts | Update expected chunk naming in shims test. |
| tests/integration/resolve/index.test.ts | Remove ADVANCED_ESM branching; unify snapshots. |
| tests/integration/redirect/jsNotResolved.test.ts | Update default export style in snapshots. |
| tests/integration/redirect/js.test.ts | Update export ordering and default export snapshots. |
| tests/integration/redirect/dts/rslib.config.mts | Add DTS redirect integration fixture (multiple variants). |
| tests/integration/redirect/dts-tsgo/rslib.config.mts | Add DTS+tsgo redirect integration fixture. |
| tests/integration/preserve-jsx/snapshots/index.test.ts.snap | Update snapshots to export default. |
| tests/integration/parser-javascript/module/rslib.config.mts | Add parser/javascript module fixture configs. |
| tests/integration/output/index.test.ts | Update expected chunk naming patterns for Rsbuild v2. |
| tests/integration/node-polyfill/index.test.ts | Update expectations for v2 output layout in node-polyfill tests. |
| tests/integration/node-polyfill/bundle/package.json | Bump fixture Rsbuild to v2 beta. |
| tests/integration/node-polyfill/bundle-false/package.json | Bump fixture Rsbuild to v2 beta. |
| tests/integration/minify/index.test.ts | Update legal comment expectations and remove ADVANCED_ESM branching. |
| tests/integration/json/index.test.ts | Unify snapshots to default ESM behavior. |
| tests/integration/iife/package.json | Set fixture package to ESM (type: module). |
| tests/integration/iife/index.test.ts | Update IIFE output snapshot (strict directive change). |
| tests/integration/format/index.test.ts | Update hash length expectation; always run eval export test. |
| tests/integration/entry/index.test.ts | Unify snapshots with new default ESM behavior. |
| tests/integration/dts/composite/process-files/package.json | Set fixture package to ESM (type: module). |
| tests/integration/dts/composite/index.test.ts | Update expected DTS output extensions (.d.ts). |
| tests/integration/dts/build/process-files/package.json | Set fixture package to ESM (type: module). |
| tests/integration/dts/build/index.test.ts | Update expected DTS output extension (.d.ts). |
| tests/integration/dts-tsgo/build/process-files/package.json | Set fixture package to ESM (type: module). |
| tests/integration/dts-tsgo/build/index.test.ts | Update expected DTS output extension (.d.ts). |
| tests/integration/bundle-false/index.test.ts | Update bundleless export snapshots and default exports. |
| tests/integration/bundle-false/snapshots/index.test.ts.snap | Update SVGR default export snapshot. |
| tests/integration/auto-external/with-externals/package.json | Set fixture package to ESM (type: module). |
| tests/integration/auto-external/module-import-warn/package.json | Set fixture package to ESM (type: module). |
| tests/integration/auto-external/false/package.json | Set fixture package to ESM (type: module). |
| tests/integration/auto-external/external-sub-path/package.json | Set fixture package to ESM (type: module). |
| tests/integration/auto-external/default/package.json | Set fixture package to ESM (type: module). |
| tests/integration/auto-external/bundle-false/package.json | Set fixture package to ESM (type: module). |
| tests/integration/auto-extension/type-commonjs/false/rslib.config.mts | Add CJS-project autoExtension fixtures. |
| tests/integration/auto-extension/type-commonjs/false-bundleless/rslib.config.mts | Add CJS-project bundleless autoExtension fixtures. |
| tests/integration/auto-extension/type-commonjs/default/rslib.config.mts | Add CJS-project default autoExtension fixture. |
| tests/integration/auto-extension/type-commonjs/config-override/rslib.config.mts | Add filename override fixtures for autoExtension. |
| tests/integration/auto-extension/index.test.ts | Remove ADVANCED_ESM branches; update expected filenames. |
| tests/integration/asset/index.test.ts | Unify snapshots and runtime expectations under new ESM defaults. |
| tests/integration/asset/snapshots/index.test.ts.snap | Update asset/SVGR default export snapshots. |
| tests/e2e/react-component/package.json | Mark e2e package as ESM (type: module). |
| tests/e2e/react-component/index.pw.test.ts | Use import.meta.dirname as ESM-friendly cwd. |
| packages/plugin-dts/package.json | Upgrade dev Rsbuild dependency to v2 beta. |
| packages/create-rslib/template-storybook/vue-ts/package.json | Update template deps for Rsbuild v2 beta compat. |
| packages/create-rslib/template-storybook/vue-js/package.json | Update template deps for Rsbuild v2 beta compat. |
| packages/create-rslib/template-storybook/react-ts/package.json | Update template deps for Rsbuild v2 beta compat. |
| packages/create-rslib/template-storybook/react-js/package.json | Update template deps for Rsbuild v2 beta compat. |
| packages/core/tests/fixtures/config/cjs/rslib.config.mts | Add .mts fixture for CJS project config loading. |
| packages/core/tests/config.test.ts | Load .mts config in CJS-project fixture; remove advancedEsm test. |
| packages/core/tests/snapshots/config.test.ts.snap | Update inspected config snapshot to Rsbuild v2 structure. |
| packages/core/src/types/rslib.ts | Rename exported server result type to StartDevServerResult. |
| packages/core/src/types/config.ts | Mark advancedEsm as deprecated in TS types. |
| packages/core/src/plugins/entryModuleLoader.ts | Remove no-op loader. |
| packages/core/src/plugins/EntryChunkPlugin.ts | Remove entry-module loader plugin path; simplify entry chunk config. |
| packages/core/src/index.ts | Re-export StartDevServerResult type. |
| packages/core/src/css/libCssExtractLoader.ts | Update CSS extract warnings for v2 CSS pipeline. |
| packages/core/src/css/cssConfig.ts | Update CSS extract integration to target new oneOf ids. |
| packages/core/src/css/const.ts | Update CSS extract constants for Rspack v2 CSS extract plugin. |
| packages/core/src/createRslib.ts | Rename MF dev server return type to StartDevServerResult. |
| packages/core/src/config.ts | Remove advancedEsm branching; align format/CSS/shims composition with Rsbuild v2. |
| packages/core/rslib.config.ts | Remove entryModuleLoader entry from build inputs. |
| packages/core/package.json | Upgrade @rsbuild/core dependency to v2 beta. |
| package.json | Remove advanced-esm CI/testing flows; exclude Vue examples from build temporarily. |
| examples/vue-component-bundleless/package.json | Upgrade example to Rsbuild v2 beta. |
| examples/module-federation/mf-remote/package.json | Upgrade example to Rsbuild v2 beta. |
| examples/module-federation/mf-react-component/package.json | Upgrade example to Rsbuild v2 beta. |
| examples/module-federation/mf-host/package.json | Upgrade example to Rsbuild v2 beta. |
| .github/workflows/test.yml | Remove the advanced ESM integration job. |
| .github/workflows/reusable-test.yml | Remove advanced ESM integration step. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
experiments.advancedEsm
Timeless0911
commented
Mar 4, 2026
fi3ework
reviewed
Mar 4, 2026
fi3ework
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR upgrades Rslib to
@rsbuild/core@2.0.0-beta.7and@rspack/core@2.0.0-beta.5and aligns@rslib/corewith Rsbuild/Rspack 2.0 behavior.Key updates
entryModuleLoaderRsbuildPluginandentryModuleLoader, since this workaround is no longer needed in Rspack v2.StartServerResulttoStartDevServerResult.output.module = falsefor CJS/UMD/IIFE formats.modern-moduletomodule.Test/CI adjustments
integration-advanced-esmCI/test lane becauseexperiments.advancedEsmis now deprecated/no-op and advanced ESM behavior is the default.ADVANCED_ESM-gated branching from integration tests and kept a single baseline expectation.TODO
Temporarily skip Vue-related coverage during migration since
rsbuild-plugin-unplugin-vuedoes not compatible with Rsbuild v2 now. Vue coverage will be re-enabled in follow-up work.tests/integration/vueESM suite is explicitly skipped.build:examplesexcludes@examples/vue-component-*.Related Links
close: #1497
close: #1453
close: #591
Checklist
Breaking changes 🚨
Drop Node.js 18 support
Rslib v0.20 requires Node.js 20.19+ or 22.12+, Node.js 18 is no longer supported.
Rsbuild / Rspack v2
Rslib v0.20 now depends on beta version of @rsbuild/core v2 and @rspack/core v2. If you use custom Rsbuild / Rspack configurations or plugins, you may need to make corresponding adjustments.
See the Rsbuild v2 upgrade guide for all breaking changes.
Deprecate
experiments.advancedEsmexperiments.advancedEsmis now deprecated and effectively ignored. Advanced ESM behavior is the default in both bundle and bundleless mode.What you need to do:
experiments.advancedEsmfrom your config.Rename type
StartServerResultThe exported type
StartServerResulthas been renamed toStartDevServerResult.