tiny-vue/internals/vue-vite-import
ajaxzheng 9e1089eed3
docs(sites): optimize docs md (#1034)
* docs(sites): optimeze docs md

* docs(sites): optimeze docs md
2023-12-07 09:33:36 +08:00
..
example docs(sites): optimize docs md (#1034) 2023-12-07 09:33:36 +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 fix(vite): update Vite version and delete useless package (#892) 2023-11-22 21:03:47 +08: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
  ]
  // ...
}