[PR #31252] chore(web): add packages to optimizePackageImports #33154

Closed
opened 2026-02-21 20:52:45 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/31252

State: closed
Merged: No


Summary

Add @remixicon/react, @lexical/react, and lexical to optimizePackageImports in next.config.js to optimize barrel imports and reduce bundle size.

Changes

  • Added @remixicon/react to optimizePackageImports
  • Added @lexical/react to optimizePackageImports
  • Added lexical to optimizePackageImports

Bundle Size Comparison

Metric Before After Diff
First Load JS (shared) 114 kB 114 kB 0
/account 692 kB 691 kB -1 kB
/activate 367 kB 366 kB -1 kB
/datasets/connect 539 kB 538 kB -1 kB

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

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran cd web && npx lint-staged (frontend) to appease the lint gods

Fixes #31246

**Original Pull Request:** https://github.com/langgenius/dify/pull/31252 **State:** closed **Merged:** No --- ## Summary Add `@remixicon/react`, `@lexical/react`, and `lexical` to `optimizePackageImports` in `next.config.js` to optimize barrel imports and reduce bundle size. ## Changes - Added `@remixicon/react` to optimizePackageImports - Added `@lexical/react` to optimizePackageImports - Added `lexical` to optimizePackageImports ## Bundle Size Comparison | Metric | Before | After | Diff | |--------|--------|-------|------| | First Load JS (shared) | 114 kB | 114 kB | 0 | | /account | 692 kB | 691 kB | -1 kB | | /activate | 367 kB | 366 kB | -1 kB | | /datasets/connect | 539 kB | 538 kB | -1 kB | 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 - [Next.js optimizePackageImports API Reference](https://nextjs.org/docs/app/api-reference/config/next-config-js/optimizePackageImports) - [How we optimized package imports in Next.js - Vercel Blog](https://vercel.com/blog/how-we-optimized-package-imports-in-next-js) ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `cd web && npx lint-staged` (frontend) to appease the lint gods Fixes #31246
yindo added the pull-request label 2026-02-21 20:52:45 -05:00
yindo closed this issue 2026-02-21 20:52:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33154