Skip to content

chore: upgrade @rspack/core to 2.0.0-beta.2#76

Merged
LingyuCoder merged 4 commits intomainfrom
chore/upgrade-rspack-2.0
Feb 26, 2026
Merged

chore: upgrade @rspack/core to 2.0.0-beta.2#76
LingyuCoder merged 4 commits intomainfrom
chore/upgrade-rspack-2.0

Conversation

@LingyuCoder
Copy link
Contributor

Summary

Upgrade @rspack/core from 1.7.1 to 2.0.0-beta.2 and fix all breaking changes introduced by the new version:

  • rspack 2.0 no longer supports the legacy libraryTarget string API. All usages (sockjs-client build script and module federation test fixtures) are migrated to the modern output.library object format (e.g. library: { type: 'umd' }).
  • Switch TypeScript compilation to CommonJS module output (module: "CommonJS", moduleResolution: "node") for compatibility with the existing CJS-based test infrastructure and runtime require() calls.
  • Fix Schema type import that failed under the new module resolution.
  • Update test snapshots to match the new rspack output.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

- Upgrade @rspack/core from 1.7.1 to 2.0.0-beta.2
- Switch tsconfig module/moduleResolution to CommonJS/node for CJS compatibility
- Replace legacy `libraryTarget` with modern `library.type` API (rspack 2.0 no longer supports the legacy API)
- Fix Schema type import from schema-utils
- Update test snapshots
Copilot AI review requested due to automatic review settings February 25, 2026 08:29
@gemini-code-assist
Copy link

Summary of Changes

Hello @LingyuCoder, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a significant upgrade of the core Rspack dependency to its 2.0.0-beta.2 version. This upgrade necessitated several adjustments across the codebase to align with breaking changes introduced in the new Rspack release. The primary goal was to ensure continued functionality and compatibility, particularly concerning module output formats, TypeScript compilation, and internal build processes, thereby preparing the project for the next major iteration of Rspack.

Highlights

  • Rspack Core Upgrade: Upgraded the @rspack/core dependency from version 1.7.1 to 2.0.0-beta.2, along with corresponding updates in pnpm-lock.yaml and the @rspack/dev-server package version.
  • Library Output Format Migration: Migrated usages of the legacy output.libraryTarget string API to the modern output.library object format (e.g., library: { type: 'umd' }) for compatibility with Rspack 2.0. This affects the sockjs-client build script and module federation test fixtures.
  • TypeScript Configuration Adjustment: Switched TypeScript compilation to use CommonJS module output and node module resolution to ensure compatibility with the existing CJS-based test infrastructure and runtime require() calls.
  • Schema Type Import Fix: Resolved an issue with the Schema type import from schema-utils by explicitly defining it as Record<string, any> due to changes in module resolution.
  • Test Snapshot Updates: Updated various test snapshots to reflect the new output generated by the upgraded Rspack version.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • package.json
    • Updated @rspack/dev-server version from 1.2.1 to 2.0.0-beta.0.
    • Upgraded @rspack/core dependency from 1.7.1 to 2.0.0-beta.2.
  • pnpm-lock.yaml
    • Updated @rspack/core and related binding package versions to 2.0.0-beta.2.
    • Removed older @rspack/binding versions and added new 2.0.0-beta.2 versions for various platforms.
    • Adjusted peer dependency requirements for @rspack/core to include @module-federation/runtime-tools and updated Node.js engine requirements.
  • scripts/build-client-modules.cjs
    • Refactored output.library configuration from library: 'SockJS', libraryTarget: 'umd' to library: { name: 'SockJS', type: 'umd' }.
  • src/server.ts
    • Modified toJson calls for MultiStats and Stats to include { assets: true } option.
    • Added an explicit type assertion as EXPECTED_ANY when creating a new webSocketServer instance.
  • src/types.ts
    • Replaced the direct import of Schema from schema-utils/declarations/validate with a direct type definition export type Schema = Record<string, any>; and added a biome-ignore comment.
  • tests/e2e/snapshots/app.test.js.snap.webpack5
    • Updated console messages and page errors in test snapshots for app option > should work using "connect" application and "spdy" server.
    • Updated console messages and page errors in test snapshots for app option > should work using "express" application and "spdy" server.
  • tests/fixtures/module-federation-config/webpack.config.js
    • Changed output.libraryTarget: 'umd' to output.library: { type: 'umd' }.
  • tests/fixtures/module-federation-config/webpack.multi.config.js
    • Changed output.libraryTarget: 'umd' to output.library: { type: 'umd' }.
  • tests/fixtures/module-federation-config/webpack.object-entry.config.js
    • Changed output.libraryTarget: 'umd' to output.library: { type: 'umd' }.
  • tests/fixtures/worker-config-dev-server-false/public/worker-bundle.js
    • Added __webpack_require__.rv and __webpack_require__.ruid runtime modules for rspack version and unique ID.
  • tsconfig.json
    • Modified compilerOptions.module from NodeNext to CommonJS.
    • Modified compilerOptions.moduleResolution from NodeNext to node.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request upgrades @rspack/core to a new major beta version and applies necessary fixes for breaking changes. The changes look good and correctly address the breaking changes from the dependency upgrade, such as migrating the libraryTarget API and updating TypeScript configurations. I have one suggestion to improve type safety for the Schema type in src/types.ts, which was changed to any as part of the fix.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades @rspack/core from version 1.7.1 to 2.0.0-beta.2 and addresses several breaking changes introduced by the new version. The upgrade includes migrating to modern library configuration syntax, adjusting TypeScript compilation settings, fixing type imports, and updating test snapshots to reflect new rspack output. However, the PR introduces critical test failures and has potential compatibility issues.

Changes:

  • Upgrade @rspack/core dependency to 2.0.0-beta.2 with corresponding package version bump to 2.0.0-beta.0
  • Migrate all libraryTarget configurations to modern library: { type } object format required by rspack 2.0
  • Switch TypeScript module system from NodeNext to CommonJS and adjust Schema type handling

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json Bumps package version to 2.0.0-beta.0 and upgrades @rspack/core to 2.0.0-beta.2
pnpm-lock.yaml Updates lockfile with rspack 2.0.0-beta.2 dependencies and bindings
tsconfig.json Changes module resolution from NodeNext to CommonJS for compatibility with rspack 2.0
src/types.ts Replaces Schema type import with generic Record type due to module resolution changes
src/server.ts Adds assets: true parameter to toJson() calls and improves WebSocket type casting
scripts/build-client-modules.cjs Migrates sockjs-client build from legacy libraryTarget to modern library object format
tests/fixtures/module-federation-config/*.js Updates test fixtures to use modern library configuration syntax
tests/fixtures/worker-config-dev-server-false/public/worker-bundle.js Updates test fixture with new rspack 2.0 runtime output
tests/e2e/snapshots/app.test.js.snap.webpack5 Updates snapshots showing spdy server test failures with SyntaxErrors
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The previous snapshots were recorded when spdy was temporarily broken,
capturing SyntaxError as expected behavior. Regenerate with correct output.
@LingyuCoder LingyuCoder merged commit 8387a44 into main Feb 26, 2026
4 checks passed
@LingyuCoder LingyuCoder deleted the chore/upgrade-rspack-2.0 branch February 26, 2026 05:14
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.

2 participants