ew-auto-import-tool provides the following command line options:
Option | Short | Description | Default Value |
---|---|---|---|
--library |
-l |
Specify the component library | None (interactive) |
--path |
-p |
Specify the project path | Current directory |
--version |
-v |
Display version number | - |
--help |
-h |
Display help information | - |
The simplest way to use the tool is to run it in the root directory of your Vue project:
The tool will guide you through the following steps:
If you want to use it in scripts or CI/CD environments, you can specify all necessary parameters:
Currently, the following component libraries are supported:
element-plus
- Element Plusant-design-vue
- Ant Design Vuenaive-ui
- Naive UIvant
- VantAfter the tool runs successfully, it will complete the following configurations:
Install necessary dependencies:
Update the vite.config.ts file, adding auto-import plugin configuration
Update the tsconfig.json file, adding declaration file references
Generate components.d.ts and auto-imports.d.ts declaration files
After configuration is complete, you can directly use the components from the component library in your Vue components without manual imports: