A Vite plugin (v1.0.7, last updated 2023) that transforms named imports from large libraries (e.g., vxe-pc-ui) into lazy, per-component import statements, automatically splitting both JavaScript and CSS. Designed for on-demand loading in Vite projects, it resolves imports to individual module paths and can inject corresponding style imports. Unlike general tree-shaking, this works at the import level, converting `import { X } from 'lib'` into `import X from 'lib/es/X/index.js'` plus optional CSS. ESM-only, TypeScript types included, maintained by the vxe-pc-ui author. Releases are infrequent; no known security incidents.
npm install vite-plugin-lazy-importVerified import paths — ran on the pinned version, not inferred.
Configures the plugin to rewrite named imports from 'vxe-pc-ui' into per-component ESM imports with CSS.
Ensure your target library is added to the resolvers array.
Explicitly set `esm: true` in your resolver config if your library uses ESM structure.
Set `importStyle: true` or `importStyle: 'css'` to enable style injection.
Use only static import syntax for the libraries you want to lazy-load.
Change to `import { lazyImport } from 'vite-plugin-lazy-import'`Use `import { lazyImport } from 'vite-plugin-lazy-import'`Add an entry for 'my-lib' in the resolvers array of the plugin options.
Set `esm: true` if using ESM path, or adjust the `resolve` function to match the actual library structure.
No dependency data recorded yet.