-
-
Notifications
You must be signed in to change notification settings - Fork 746
feat: EsmLibraryPlugin can override invalid user config #12028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this 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
applyLimitsfunction - 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
checkConfigvalidation is now redundant and will always fail. SinceapplyLimitsis called on line 59 and setsconcatenateModulestofalse(line 10) andchunkFormattofalse(line 13), the subsequentcheckConfigcall on line 63 will check these same values that were just set. This validation should either be removed or moved beforeapplyLimitsis 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.
📦 Binary Size-limit
❌ Size increased by 384bytes from 47.81MB to 47.81MB (⬆️0.00%) |
CodSpeed Performance ReportMerging #12028 will not alter performanceComparing Summary
Footnotes |
9516982 to
f4e4cb0
Compare
f4e4cb0 to
7953269
Compare
Summary
EsmLibraryPlugin will override user's invalid config
Related links
Checklist