optimizePackageImports
某些包可能会导出数百甚至数千个模块,这可能导致开发和生产环境下的性能问题。
将包添加到 experimental.optimizePackageImports 后,只会加载您实际使用的模块,同时仍保留通过具名导出编写导入语句的便利性。
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/*