Skip to content

feat: add experimental ESM output support for node target#5823

Merged
chenjiahan merged 3 commits intomainfrom
node_esm_0812
Aug 12, 2025
Merged

feat: add experimental ESM output support for node target#5823
chenjiahan merged 3 commits intomainfrom
node_esm_0812

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

@chenjiahan chenjiahan commented Aug 12, 2025

Summary

Add output.module config to enable experimental ESM output format when target is node. This includes adding a new plugin to handle ESM-specific Rspack configurations and updating related type definitions and test cases.

The feature is marked as experimental and currently only supports node target. This provides a foundation for future ESM support in other targets.

export default {
  output: {
    module: true,
  }
}

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required). -> will be added in future PRs

Copilot AI review requested due to automatic review settings August 12, 2025 06:00
Copy link
Copy Markdown
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

Adds experimental ESM output support for node targets by introducing a new output.module configuration option. This enables developers to generate JavaScript files in ES modules format when targeting Node.js environments.

  • Introduces a new output.module boolean configuration option to enable ESM output
  • Implements a new ESM plugin that automatically configures Rspack for ESM output when enabled
  • Updates existing test configurations to use the new simplified ESM configuration

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/core/src/types/config.ts Adds module property to output configuration types with experimental annotation
packages/core/src/plugins/esm.ts New plugin implementing ESM-specific Rspack configurations and node target validation
packages/core/src/defaultConfig.ts Sets default value for module configuration to false
packages/core/src/createRsbuild.ts Registers the new ESM plugin in the default plugin list
e2e/cases/server/ssr/rsbuild.config.ts Updates test to use simplified ESM configuration
e2e/cases/server/ssr-type-module/rsbuild.config.ts Replaces manual Rspack configuration with new ESM option

Comment thread packages/core/src/plugins/esm.ts Outdated
@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 12, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit dc84514
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/689ada2333c6a50008f06f9c
😎 Deploy Preview https://deploy-preview-5823--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: 75 (🟢 up 10 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.

@chenjiahan chenjiahan merged commit 2db53a9 into main Aug 12, 2025
11 checks passed
@chenjiahan chenjiahan deleted the node_esm_0812 branch August 12, 2025 06:16
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.

2 participants