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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lx-frontend/uniapp-global-components-register-plugin

v2.2.1

Published

## 安装 ``` npm install --save-dev @lx-frontend/uniapp-global-components-register-plugin ```

Downloads

1

Readme

uniapp-global-components-register-plugin

安装

npm install --save-dev @lx-frontend/uniapp-global-components-register-plugin

该插件解决什么问题?

uniapp项目中,/components文件夹下的所有组件默认被打包进主包,导致主包体积过大。实际项目中,主包页面没有使用的组件都可以分散到各个子包中去,但是操作上有难度,因为在编写一个组件时,可能暂时无法确定组件是否会在其他分包中使用,所以也就无法确定是否应该将组件放进子包还是主包。 该插件将用来解决这个问题。插件通过分析最终生成的小程序页面json文件,确定每个分包实际使用了哪些组件,然后将主包没有使用到的组件从主包移动到各个分包中,并修改代码对组件引用的位置。

优点

将所有主包页面没有使用的组件从主包中剔除,并分散到各个子包,减小了主包体检。在后续的开发中,只要主包页面保持不变,添加组件将不会再增加主包体积。

缺点

插件采用了最极端的做法,即,只要主包没有使用的组件,一律打包进分包,而在实际情况中,两个分包可能会共用一个不在主包的组件,这会导致该组件在两个分包中各存在一份相同代码,也就是冗余问题。更精细的做法是,统计组件被分包引用的次数,并设置阈值,超过阈值则打包进主包。但考虑到大部分分包体积实际并不大,并且对体验影响没有主包重要,所以暂时不处理这个问题。