# @opentiny/vue-vite-import

> A TinyVue vite import plugin

Latest version **1.4.0** (published 2025-09-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @opentiny/vue-vite-import
pnpm add @opentiny/vue-vite-import
yarn add @opentiny/vue-vite-import
bun add @opentiny/vue-vite-import
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2025-09-08 |
| First published | 2023-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 437.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2272 |
| Author | Tiny Vue Team |
| Maintainers | opentiny |
| Keywords | vite-plugin, TinyVue, vite |

## Links

- npm: https://www.npmjs.com/package/@opentiny/vue-vite-import
- Repository: https://github.com/opentiny/tiny-vue
- Homepage: https://github.com/opentiny/tiny-vue#readme
- Issues: https://github.com/opentiny/tiny-vue/issues
- npm.io page: https://npm.io/package/@opentiny/vue-vite-import

## Dependencies (1)

- [change-case](https://npm.io/package/change-case.md) ^4.1.2

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.4.0 (latest) — 2025-09-08
- 1.3.0 — 2025-02-08
- 1.2.0 — 2024-08-12
- 1.1.5 — 2023-06-30
- 1.1.4 — 2023-06-30
- 1.1.3 — 2023-06-10
- 1.1.2 — 2023-06-08
- 1.1.1 — 2023-05-25
- 1.1.0 — 2023-05-18
- 1.0.0 — 2023-04-14

## README

# vite-plugin-import

A TinyVue vite import plugin.

## install

```bash
npm i @opentiny/vue-vite-import -D
```

## Example

```js
import { ButtonGroup } from '@opentiny/vue';
import { iconShare } from '@opentiny/vue-icon'

        ↓ ↓ ↓ ↓ ↓ ↓

import ButtonGroup from '@opentiny/vue-button-group';
import iconShare from '@opentiny/vue-icon/lib/icon-share.js'
```

## Usage

```js
// vite.config.js

// ...
import importPlugin from '@opentiny/vue-vite-import'
// ...
export default {
  // ...
  plugins: [
    // ...
    importPlugin(
      [
        {
          libraryName: '@opentiny/vue',
          split: '-' // 自定义分隔符
        },
        {
          libraryName: '@opentiny/vue-icon',
          customName: (name) => {
            // 自定义模块名称
            return `@opentiny/vue-icon/lib/${name.replace(/^icon-/, '')}.js`
          }
        }
      ],
      'pc'
    ) // 第二个参数可选，表示只打包pc或者移动模板 pc | mobile | undefined
  ]
  // ...
}
```

_1.2.0版本新增参数重载_

```js
// vite.config.js

// ...
import importPlugin from '@opentiny/vue-vite-import'
// ...
export default {
  // ...
  plugins: [
    // ...
    importPlugin(
      {
        options: [
          {
            libraryName: '@opentiny/vue',
            split: '-' // 自定义分隔符
          },
          {
            libraryName: '@opentiny/vue-icon',
            customName: (name) => {
              // 自定义模块名称
              return `@opentiny/vue-icon/lib/${name.replace(/^icon-/, '')}.js`
            }
          }
        ],
        mode: 'pc', // mode可选，表示只打包pc或者移动模板 pc | mobile | undefined
        exclude: [/test\.vue/] // 可选，表示需要剔除掉的文件
      },
      'pc'
    )
  ]
  // ...
}
```

---
_Source: https://npm.io/package/@opentiny/vue-vite-import · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
