-
Notifications
You must be signed in to change notification settings - Fork 19.7k
chore(web): add packages to optimizePackageImports #31252
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
Summary of ChangesHello @cxhello, 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 enhances the Next.js application's build process by configuring Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds @remixicon/react, @lexical/react, and lexical to the optimizePackageImports configuration in next.config.js. This is a good practice for optimizing barrel imports and potentially reducing the application's bundle size, as recommended by Next.js. The change is correct and beneficial. I've added one suggestion to sort the list of packages alphabetically to improve code maintainability.
| '@heroicons/react', | ||
| '@remixicon/react', | ||
| '@lexical/react', | ||
| 'lexical', |
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.
For better readability and easier maintenance, it's a good practice to keep lists like this sorted alphabetically. This helps in quickly finding an entry and prevents duplicates when the list grows.
| '@heroicons/react', | |
| '@remixicon/react', | |
| '@lexical/react', | |
| 'lexical', | |
| '@heroicons/react', | |
| '@lexical/react', | |
| '@remixicon/react', | |
| 'lexical', |
|
Thank you for your attention, but these packages can't be optimized like that. For example, @remixicon/react doesn't have barrel files. This issue is invalid. https://www.npmjs.com/package/@remixicon/react?activeTab=code Let me know if I'm wrong. |
|
In fact, @heroicons/react is included in the default configuration, and we can remove this configuration. |
Summary
Add
@remixicon/react,@lexical/react, andlexicaltooptimizePackageImportsinnext.config.jsto optimize barrel imports and reduce bundle size.Changes
@remixicon/reactto optimizePackageImports@lexical/reactto optimizePackageImportslexicalto optimizePackageImportsBundle Size Comparison
The optimization effect is minimal because the project likely already has good import practices. However, this change follows Next.js best practices and may provide more significant benefits as the project grows.
Screenshots
N/A - Configuration change only
References
Checklist
cd web && npx lint-staged(frontend) to appease the lint godsFixes #31246