tiny-vue/internals/vue-vite-import
zzcr 0feddf25ad
feat: update code
2023-10-23 01:09:44 -07:00
..
example feat: add dialog-select and refactor sites (#378) 2023-08-11 16:40:06 +08:00
src feat: add dialog-select and refactor sites (#378) 2023-08-11 16:40:06 +08:00
.npmignore feat(TinyVue): 同步内部代码,解决若干bug 2023-06-10 00:54:00 -07:00
README.md fix: fix conflict (#135) 2023-04-13 20:41:25 +08:00
package.json feat: update code 2023-10-23 01:09:44 -07:00
tsconfig.json feat(TinyVue): 同步内部代码,解决若干bug 2023-06-10 00:54:00 -07: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
  ]
  // ...
}