Skip to content

[Build] Migrate Webpack4 to Rspack#11102

Merged
ruanyl merged 38 commits intoopensearch-project:mainfrom
ruanyl:rspack
Jan 15, 2026
Merged

[Build] Migrate Webpack4 to Rspack#11102
ruanyl merged 38 commits intoopensearch-project:mainfrom
ruanyl:rspack

Conversation

@ruanyl
Copy link
Member

@ruanyl ruanyl commented Dec 24, 2025

Description

This PR migrates the OpenSearch Dashboards build system from Webpack to Rspack, RFC: #11125

This PR also combines @yubonluo's Webpack 5 migration of storybook #11107, see more discussions of storybook migration here: #11125 (comment)

Core changes

  1. Migrated from webpack to @rspack/core for the build toolchain
  2. Updated webpack configurations across multiple packages to support Rspack
  3. Replaced BundleRefsPlugin with VirtualModulesPlugin
  4. Refactor entry_point_creator.ts and osd_bundles_loader_source.js, this changes how bundles are loaded and made available throughout the application
  5. Added bundle_deps_check_plugin.ts for dependency validation
  6. Migration storybook to Webpack5

Modified packages

  1. packages/osd-optimizer - Core optimizer package with major webpack config refactoring
  2. packages/osd-monaco - Updated build scripts and migrate Webpack config to Rspack
  3. packages/osd-pm - Updated package manager and migrate Webpack config to Rspack
  4. packages/osd-ui-shared-deps - Updated shared dependencies bundling and migrate Webpack config to Rspack
  5. packages/osd-ui-framework - Updated build configuration and migrate Webpack config to Rspack
  6. packages/osd-std - Updated package dependencies
  7. Cleanup packages that are no longer needed but causing single version check issue(more post cleanup need to be done after the migration)

Extra changes

Step "Build plugins" of cypress workflow cypress_workflow.yml is changed to production build(added --dist flag), this is add to solve the Github workflow "No space" issue which failed the step "Extract OpenSearch", also for CI jobs, it's preferrable to run the cypress tests against production build.

Run cypress tests (osd:ciGroup13)
System.IO.IOException: No space left on device : '/home/runner/actions-runner/cached/_diag/Worker_20260114-000736-utc.log'

Rspack produces slightly larger assets in development mode comparing with webpack4, adding --dist will produce production build which is smaller. This is also an indicator that the current workflow runner has very limited spaced left, we might face similar issue in the future for example when opensearch image size increase as we download and extract it in the workflow.

Issues Resolved

Screenshot

Testing the changes

Changelog

  • refactor: migrate OSD build from Webpack4 to Rspack

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Summary by CodeRabbit

  • Refactor

    • Migrate the build toolchain from Webpack 4 to Rspack and replace Babel with SWC; Storybook upgraded to Webpack 5.
  • Chores

    • Update many build/dev dependencies, modernize Sass/CSS and asset handling, and add a centralized SWC loader export.
  • New Features

    • Add build-time bundle dependency validation to catch invalid bundle imports earlier.
  • Bug Fixes

    • Add Node path polyfills and relax module resolution to fix import resolution issues.
  • Tests

    • Update snapshots and test expectations to match new build outputs.
  • Documentation

    • Add changelog entry for the build migration.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
+ update limits.yml

Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
@ruanyl ruanyl merged commit 4c3aa03 into opensearch-project:main Jan 15, 2026
130 of 135 checks passed
This was referenced Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants