refactor: update rspack import paths#7072
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary of ChangesHello @chenjiahan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request modernizes the module import strategy for the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly refactors the import paths for rspack to use the ESM package from @rspack/core, removing the previous CommonJS require workaround. The changes are applied consistently across the codebase. I've added a few suggestions to combine type and value imports from @rspack/core into single statements for better code consistency and readability.
There was a problem hiding this comment.
Pull request overview
This PR removes a local helper module that was previously used to load rspack via CommonJS for performance reasons. With @rspack/core 2.0 being a pure ESM package, the workaround is no longer needed, and all imports can now directly use ESM imports from @rspack/core.
Changes:
- Removed the
packages/core/src/rspack.tshelper module that used CommonJS require - Updated all runtime imports of
rspackacross 13 files to import directly from@rspack/core
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/rspack.ts | Deleted helper module that used CommonJS require for performance |
| packages/core/src/server/devMiddlewares.ts | Updated rspack import to use direct ESM import from @rspack/core |
| packages/core/src/server/assets-middleware/index.ts | Updated rspack import to use direct ESM import from @rspack/core |
| packages/core/src/rspackConfig.ts | Updated rspack import to use direct ESM import from @rspack/core |
| packages/core/src/rspack-plugins/RsbuildHtmlPlugin.ts | Updated rspack import to use direct ESM import from @rspack/core |
| packages/core/src/plugins/rspackProfile.ts | Updated rspack import to use direct ESM import from @rspack/core |
| packages/core/src/plugins/nonce.ts | Updated rspack import to use direct ESM import from @rspack/core |
| packages/core/src/plugins/moduleFederation.ts | Updated rspack import to use direct ESM import from @rspack/core |
| packages/core/src/pluginHelper.ts | Updated rspack import to use direct ESM import from @rspack/core |
| packages/core/src/initPlugins.ts | Updated rspack import to use direct ESM import from @rspack/core |
| packages/core/src/index.ts | Updated rspack import to use direct ESM import from @rspack/core |
| packages/core/src/helpers/compiler.ts | Updated rspack import to use direct ESM import from @rspack/core |
| packages/core/src/createCompiler.ts | Updated rspack import to use direct ESM import from @rspack/core |
| packages/core/src/build.ts | Updated rspack import to use direct ESM import from @rspack/core |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Previously,
rspackwas loaded via a local helper module using CommonJSrequirefor performance. Now@rspack/core2.0 is a pure ESM package, we can remove therequireworkaround.Checklist