Vite plugin to optimize barrel (re-export) file imports, improving build performance for packages with many exports like @mui/icons-material. Current stable version is 0.4.1, released monthly. Requires Vite ^5 and Node >=18. Uses SWC under the hood via swc-plugin-barrel; watch out for @swc/core version compatibility. Key differentiator: dedicated barrel-import optimization for Vite, inspired by Next.js optimizePackageImports, with integration support for @vitejs/plugin-react-swc.
npm install vite-plugin-barrelVerified import paths — ran on the pinned version, not inferred.
Configures vite-plugin-barrel to optimize imports from @mui/material and @mui/icons-material, improving build performance by 50%+.
Pin @swc/core to match plugin version range as documented.
Follow the integration example in README, passing swc_plugin_barrel to react's plugins array.
Use named imports like import { Button } from '@mui/material' instead of import Mui from '@mui/material'.If cache issues, set cacheRoot option explicitly.
Check swc_compat_range_docs and install compatible @swc/core (e.g., npm install @swc/core@1.6.7 for v0.2.x-0.3.x).
Use import { barrel } from 'vite-plugin-barrel'.Run pnpm add vite-plugin-barrel and ensure tsconfig includes types.