Skip to content

Conversation

@JSerFeng
Copy link
Contributor

Summary

EsmLibraryPlugin will override user's invalid config

  • chunkFormat: EsmLibraryPlugin has unique chunk loading algorithm
  • concatenateModules: EsmLibraryPlugin handles the scope hoisting
  • library: EsmLibraryPlugin will eventually be the libraryType in the future
  • splitChunks: EsmLibraryPlugin no need some default rules that can optimize for Web

Related links

Checklist

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

@JSerFeng JSerFeng marked this pull request as ready for review October 29, 2025 05:54
@netlify
Copy link

netlify bot commented Oct 29, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 7953269
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6901d8ba57002c0008c815a2

Copilot AI review requested due to automatic review settings October 29, 2025 05:54
@github-actions github-actions bot added release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack. labels Oct 29, 2025
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 refactors the EsmLibraryPlugin to automatically apply required configuration options instead of requiring users to manually configure them. The plugin now sets necessary options like chunkFormat, concatenateModules, and chunkLoading internally, removing the burden from users.

  • Moved configuration logic from user responsibility to automatic plugin setup via new applyLimits function
  • Enhanced split chunks configuration with additional settings for better ESM library output
  • Added empty source check in Rust render code to avoid generating unnecessary wrapper code

Reviewed Changes

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

Show a summary per file
File Description
website/docs/zh/plugins/rspack/esm-library-plugin.mdx Removed manual configuration requirements from Chinese documentation
website/docs/en/plugins/rspack/esm-library-plugin.mdx Removed manual configuration requirements from English documentation
packages/rspack/src/builtin-plugin/EsmLibraryPlugin.ts Added applyLimits function to automatically configure required options and enhanced split chunks settings
packages/rspack-test-tools/src/case/esm-output.ts Removed manual configuration from test defaults since plugin now handles it
crates/rspack_plugin_esm_library/src/render.rs Added check to skip rendering empty module declarations
Comments suppressed due to low confidence (1)

packages/rspack/src/builtin-plugin/EsmLibraryPlugin.ts:67

  • The checkConfig validation is now redundant and will always fail. Since applyLimits is called on line 59 and sets concatenateModules to false (line 10) and chunkFormat to false (line 13), the subsequent checkConfig call on line 63 will check these same values that were just set. This validation should either be removed or moved before applyLimits is called to validate user-provided configuration before automatic correction.
		let err;
		if ((err = checkConfig(compiler.options))) {
			throw new rspack.WebpackError(
				`Conflicted config for ${EsmLibraryPlugin.PLUGIN_NAME}: ${err}`
			);
		}

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 29, 2025

📦 Binary Size-limit

Comparing 7953269 to test: migrate more jest tests to rstest (#12030) by 9aoy

❌ Size increased by 384bytes from 47.81MB to 47.81MB (⬆️0.00%)

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 29, 2025

CodSpeed Performance Report

Merging #12028 will not alter performance

Comparing esm-lib-plugin (7953269) with main (bc91724)1

Summary

✅ 17 untouched

Footnotes

  1. No successful run was found on main (ef1ac08) during the generation of this report, so bc91724 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@JSerFeng JSerFeng force-pushed the esm-lib-plugin branch 2 times, most recently from 9516982 to f4e4cb0 Compare October 29, 2025 07:45
@JSerFeng JSerFeng merged commit e386322 into main Oct 29, 2025
86 checks passed
@JSerFeng JSerFeng deleted the esm-lib-plugin branch October 29, 2025 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants