tiny-vue/internals/vue-vite-import
Kagol b319be37ef
docs: update contributors
2023-05-25 14:39:53 +08:00
..
example fix: fix some XDesign bug 2023-05-25 14:26:49 +08:00
src fix: fix some XDesign bug 2023-05-25 14:26:49 +08:00
README.md fix: fix conflict (#135) 2023-04-13 20:41:25 +08:00
package.json docs: update contributors 2023-05-25 14:39:53 +08:00
tsconfig.json fix: fix conflict (#135) 2023-04-13 20:41:25 +08:00

README.md

vite-plugin-babel-import

A TinyVue vite import plugin.

install

npm i @opentiny/vue-vite-import -D

Example

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

// 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
  ]
  // ...
}