Skip to content

Conversation

fi3ework
Copy link
Member

Summary

port web-infra-dev/rsbuild#5955 before it can landed in Rsbuild (too much breaking as of now, may land it in v2).

fix #1185.

Related Links

Checklist

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

Copy link

netlify bot commented Aug 27, 2025

Deploy Preview for rslib ready!

Name Link
🔨 Latest commit c5706a1
🔍 Latest deploy log https://app.netlify.com/projects/rslib/deploys/68aee1bbbd412700082e098d
😎 Deploy Preview https://deploy-preview-1193--rslib.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@fi3ework fi3ework force-pushed the interop branch 2 times, most recently from c5706a1 to d09dacc Compare August 27, 2025 11:03
@fi3ework fi3ework marked this pull request as ready for review August 27, 2025 11:10
@Copilot Copilot AI review requested due to automatic review settings August 27, 2025 11:10
Copy link
Contributor

@Copilot 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 fixes ESM (ECMAScript Modules) interop issues by porting a fix from Rsbuild that corrects module type handling. The fix ensures proper handling of modules when bundling for different formats.

  • Adds a new fixJsModuleTypePlugin that removes the 'type' setting from JavaScript module rules
  • Applies the fix across all output formats (ESM, CJS, UMD, IIFE, MF) to ensure consistent module handling
  • Includes comprehensive test coverage for ESM interop scenarios

Reviewed Changes

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

Show a summary per file
File Description
packages/core/src/config.ts Implements the core fix by adding fixJsModuleTypePlugin and applying it to all format configurations
tests/integration/format/index.test.ts Adds integration test to verify ESM interop works correctly
tests/integration/format/esm-interop/* Creates test fixture with module import/export scenarios
packages/core/tests/config.test.ts Adds snapshot testing for the new configuration
packages/core/setupRstestTests.ts Sets up test environment with snapshot serialization
packages/core/rstest.config.ts Configures test setup file
packages/core/package.json Adds path-serializer dependency for testing
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Copy link
Contributor

@Timeless0911 Timeless0911 left a comment

Choose a reason for hiding this comment

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

Rsbuild configuration snapshot may need frequent updates, which remains to be seen.

@Timeless0911 Timeless0911 merged commit 02278ff into main Aug 27, 2025
14 checks passed
@Timeless0911 Timeless0911 deleted the interop branch August 27, 2025 11:35
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