npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@uni-helper/vite-plugin-uni-components

v0.4.1

Published

适用于 uni-app (Vue3) 的 unplugin-vue-components,按需自动导入组件

Downloads

13,390

Readme

@uni-helper/vite-plugin-uni-components

Fork 自 unplugin-vue-components,修改以适配 uni-app (Vue3):在模板中使用组件时无需手动注册,自动按需导入。

不想看文档?直接问 AI 🤖

安装

pnpm i -D @uni-helper/vite-plugin-uni-components

使用

// vite.config.ts
import Uni from '@dcloudio/vite-plugin-uni'
import Components from '@uni-helper/vite-plugin-uni-components'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    Components(), // 需要在 Uni() 之前调用
    Uni(),
  ],
})

插件默认扫描 src/components 目录。components.d.ts 会自动生成,提供组件类型提示。

📖 完整配置项请阅读在线文档,通用配置项可参考 unplugin-vue-components 文档。

从 UI 库导入

内置以下 UI 库的 resolver,从 @uni-helper/vite-plugin-uni-components/resolvers 导入:

// vite.config.ts
import Uni from '@dcloudio/vite-plugin-uni'
import Components from '@uni-helper/vite-plugin-uni-components'
import { UniUIResolver } from '@uni-helper/vite-plugin-uni-components/resolvers'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    Components({
      resolvers: [
        UniUIResolver()
      ],
    }),
    Uni(),
  ],
})

| UI 库 | Resolver | | --- | --- | | Ano UI | AnoResolver | | TDesign UniApp | TDesignUniappResolver | | uni-ui | UniUIResolver | | uv-ui | UvResolver | | uview-pro | uViewProResolver | | wot-design-uni | WotResolver | | wot-ui | WotV2Resolver | | z-paging | ZPagingResolver |

TDesignUniappResolver、UniUIResolver、ZPagingResolver 支持 exclude 选项过滤不需要解析的组件名;uViewProResolver 可以传入路径前缀以支持 uni_modules 安装方式,例如 uViewProResolver('@/uni_modules/uview-pro')。

组件类型提示

如果使用 pnpm,请在项目根目录创建 .npmrc 文件提升 @vue 相关依赖,参见 issue:

// .npmrc
public-hoist-pattern[]=@vue*
// 或者
// shamefully-hoist = true

更多信息见 unplugin-vue-components。

对第三方组件(如 dcloudio/uni-ui、ano-ui),本插件在 components.d.ts 中生成 default 类型入口,解决 H5 端无法正确处理组件的问题:

declare module 'vue' {
  export interface GlobalComponents {
-  AButton: typeof import('ano-ui/components/AButton/AButton.vue')['AButton']
+  AButton: typeof import('ano-ui/components/AButton/AButton.vue')['default']
    Book: typeof import('./src/components/book/index.vue')['default']
-  UniCalendar: typeof import('@dcloudio/uni-ui/lib/uni-calendar/uni-calendar.vue')['UniCalendar']
+  UniCalendar: typeof import('@dcloudio/uni-ui/lib/uni-calendar/uni-calendar.vue')['default']
  }
}

关联项目

许可证

MIT License © 2022-PRESENT Neil Lee