optimizePackageImports
某些套件可能會匯出數百或數千個模組,這可能會導致開發和生產環境中的效能問題。
將套件加入 experimental.optimizePackageImports 後,系統將僅載入您實際使用的模組,同時仍可讓您方便地使用包含多個命名匯入的 import 語句。
module.exports = {
experimental: {
optimizePackageImports: ['package-name'],
},
}以下函式庫已預設進行優化:
lucide-reactdate-fnslodash-esramdaantdreact-bootstrapahooks@ant-design/icons@headlessui/react@headlessui-float/react@heroicons/react/20/solid@heroicons/react/24/solid@heroicons/react/24/outline@visx/visx@tremor/reactrxjs@mui/material@mui/icons-materialrechartsreact-use@material-ui/core@material-ui/icons@tabler/icons-reactmui-corereact-icons/*