{"id":42230,"library":"vite-plugin-importus","title":"vite-plugin-importus","description":"Vite plugin for modular import transformation, automatically converting named imports from a library into path-specific imports and optional style imports. Version 1.0.5 requires Vite >=2 and Node >=14. It uses acorn and es-module-lexer for faster transforms (claimed 90% faster than alternatives like vite-plugin-import and vite-plugin-importer). Inspired by babel-plugin-import, it supports the same options. TypeScript types are included. Release cadence is irregular.","status":"active","version":"1.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/Geocld/vite-plugin-importus","tags":["javascript","vite","import","typescript"],"install":[{"cmd":"npm install vite-plugin-importus","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-importus","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-importus","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; plugin only works with Vite","package":"vite","optional":false}],"imports":[{"note":"Default export; ESM-only. CommonJS require will fail in Vite ESM context.","wrong":"const vitePluginImportus = require('vite-plugin-importus')","symbol":"vitePluginImportus","correct":"import vitePluginImportus from 'vite-plugin-importus'"},{"note":"This is a type export; do not import it as a value.","wrong":"import { VitePluginImportusOptions } from 'vite-plugin-importus'","symbol":"VitePluginImportusOptions","correct":"import type { VitePluginImportusOptions } from 'vite-plugin-importus'"},{"note":"The plugin returns PluginOption; ensure Vite types are installed.","wrong":"","symbol":"PluginOption","correct":"import { PluginOption } from 'vite'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite'\nimport vitePluginImportus from 'vite-plugin-importus'\n\nexport default defineConfig({\n  plugins: [\n    vitePluginImportus([\n      {\n        libraryName: 'antd',\n        libraryDirectory: 'es',\n        style: 'css',\n      },\n    ]),\n  ],\n})\n\n// Then in your app code:\nimport { Button } from 'antd'\n// Transforms to: import Button from 'antd/es/button' and style imports","lang":"typescript","description":"Configures the plugin in vite.config.ts to transform antd named imports to path-specific imports with CSS."},"warnings":[{"fix":"Verify the exact path structure of the library (e.g., 'es' vs 'lib') and style entry (e.g., 'css' vs 'style/css').","message":"Plugin options array must match library directory structure; incorrect libraryDirectory or style path may cause import errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use static imports for the targeted library, or use a different plugin if you need dynamic import support.","message":"Plugin does not support dynamic imports or re-exports; only works with static import statements.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use the 'libraryName' and 'libraryPath' options to fine-tune; check library documentation for correct path.","message":"Using with libraries that have side-effect imports may result in duplicated or missing imports.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.5':28 '14':34 '2':31 '90':47 'acorn':37 'altern':50 'automat':11 'babel':64 'babel-plugin-import':63 'cadenc':77 'claim':46 'convert':12 'es':40 'es-module-lex':39 'faster':44,48 'import':9,14,22,26,55,60,66,82 'importus':4 'includ':75 'inspir':61 'irregular':79 'javascript':80 'lexer':42 'librari':17 'like':51 'modul':41 'modular':8 'name':13 'node':33 'option':24,71 'path':20 'path-specif':19 'plugin':3,6,54,59,65 'releas':76 'requir':29 'specif':21 'style':25 'support':68 'transform':10,45 'type':73 'typescript':72,83 'use':36 'version':27 'vite':2,5,30,53,58,81 'vite-plugin-import':52,57 'vite-plugin-importus':1","created_at":"2026-06-04T18:56:15.350173+00:00","updated_at":"2026-06-04T18:56:15.350173+00:00","problems":[{"fix":"Run 'npm install -D vite-plugin-importus' and ensure 'vite.config.ts' is included in tsconfig.","cause":"Missing dependency or TypeScript not configured to resolve Vite plugins.","error":"Cannot find module 'vite-plugin-importus' or its corresponding type declarations."},{"fix":"Double-check the 'libraryDirectory' (e.g., 'es', 'lib') and ensure the path exists in the node_modules library.","cause":"Incorrect libraryPath or libraryName options cause the plugin to generate unresolvable imports.","error":"Transform failed with error: could not resolve import"},{"fix":"Ensure Vite >=2 is installed and that the plugin is listed in the plugins array, not nested.","cause":"Plugin executed before Vite has resolved peer dependencies.","error":"Uncaught TypeError: Cannot read properties of undefined (reading 'transform')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/Geocld/vite-plugin-importus#readme","github":"https://github.com/Geocld/vite-plugin-importus","docs":null,"changelog":null,"pypi":null,"npm":"vite-plugin-importus","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}