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/plugin-uni

v0.1.2

Published

uni-app plugin 的 ESM 导出

Readme

@uni-helper/plugin-uni

把官方 @dcloudio/vite-plugin-uni 以 ESM 形式导出,在 ESM 配置里直接 import。

不想看文档?直接问 AI 🤖

请考虑持续赞助以维持该项目的持续健康发展,非常感谢!🙏

简介

@dcloudio/vite-plugin-uni 是 CJS 包。在 ESM 配置里 import Uni from '@dcloudio/vite-plugin-uni' 拿到的是整个 module.exports,还得自己再取一次 .default。本包把这一步包好,只做重导出,不包含运行时逻辑,也不限制官方插件的版本。

安装

npm i -D @uni-helper/plugin-uni

官方插件 @dcloudio/vite-plugin-uni 需要自己装,本包通过 peerDependencies 使用它。

使用

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

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

配置按 ESM 写(import)即可,playground 的 package.json 设了 "type": "module"。

Uni() 的选项和官方插件相同:uvue、vueOptions、vueJsxOptions、viteLegacyOptions、autoImportOptions。需要用类型时从 @dcloudio/vite-plugin-uni 导入。

工作原理

  • src/index.js 只有一行 export default uni.default ?? uni:官方插件带 .default 就取它,否则直接用导入结果。
  • src/index.cjs 是 require 条件的入口,写法相同:module.exports = uni.default ?? uni。
  • src/index.d.ts 重导出官方插件的默认类型,IDE 提示和官方插件保持一致。
  • peerDependencies 写的是 *,官方插件用哪个版本由你的项目决定,本包不用跟着发版。

问题反馈

构建出错时先确认是不是官方插件的问题,是的话提到 dcloudio/uni-app。

确认问题出在转发层,再到 uni-helper/plugin-uni 提 issue,附上最小复现仓库。

官方插件提供原生 ESM 版本后,本包会归档并停止维护。

参与贡献

请阅读 CONTRIBUTING.md。

许可证

MIT

赞助