Skip to content

feat: experimental support for ESM web applications#6356

Merged
chenjiahan merged 1 commit intomainfrom
web_esm_1014
Oct 14, 2025
Merged

feat: experimental support for ESM web applications#6356
chenjiahan merged 1 commit intomainfrom
web_esm_1014

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Oct 14, 2025

Summary

Rspack has introduced ESM HMR support in recent releases. This enables Rsbuild to support the output.module: true when target is web.

As the ESM web application has not yet been fully tested, it has been marked as experimental and more test cases are planned.

Links

#6332

Checklist

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

Copilot AI review requested due to automatic review settings October 14, 2025 12:50
@netlify
Copy link

netlify bot commented Oct 14, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 1ea056f
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68ee4703000af90008079232
😎 Deploy Preview https://deploy-preview-6356--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 56 (🔴 down 7 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

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 adds experimental support for ESM web applications in Rsbuild by leveraging Rspack's recent ESM HMR support. The main purpose is to enable output.module: true for web targets while maintaining HMR functionality.

Key changes:

  • Updated ESM plugin to support web targets with experimental warning and runtime chunk configuration
  • Modified HTML plugin to automatically use module script loading when ESM output is enabled
  • Added comprehensive HMR test coverage for ESM web applications

Reviewed Changes

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

Show a summary per file
File Description
packages/core/src/types/config.ts Updated documentation for scriptLoading to clarify module mode behavior
packages/core/src/plugins/html.ts Added logic to force module script loading when output.module is enabled
packages/core/src/plugins/esm.ts Extended ESM support to web targets with experimental warning and runtime chunk fix
e2e/cases/hmr/esm/* Added new test case for ESM HMR functionality with React components
e2e/cases/hmr/basic/index.test.ts Minor test description and formatting improvements

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@chenjiahan chenjiahan merged commit 26061fb into main Oct 14, 2025
12 checks passed
@chenjiahan chenjiahan deleted the web_esm_1014 branch October 14, 2025 13:01
@chenjiahan chenjiahan mentioned this pull request Oct 30, 2025
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.

1 participant