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

babel-preset-zcs

v1.1.5

Published

一个独立的生成babel配置项目,配合npm命令和cli可以本地测试babel编译效果。

Downloads

19

Readme

简介

一个独立的生成babel配置项目,配合npm命令和cli可以本地测试babel编译效果。

灵感

来源于createreactapp中的https://github.com/facebook/create-react-app/tree/next/packages/babel-preset-react-app这个包, 把babel配置单独处理,根据环境变量生成对应配置。

createreactapp的解读

开发环境

cra在开发环境中注入全局polyfill(通过entry配置),然后在preset中设置useBuilt为entry,防止二次引入polyfit, 然后通过设置各个插件或preset中的useBuilt选项,让类似(promise,object.assign)等不被编译,使用原始全局变量, 与之相对的做法就是不引入polyfit,利用trasform-runtime来处理:有三个选项

  1. helpers:公共的帮助方法(比如校验class的函数)统一替换(这里cra是false,可能为了开发的编译速度,牺牲了空间)。
  2. pollfit:是否使用模拟的方法(这里cra是false,因为已经引入了)
  3. generator: 是否提供generator帮助方法(这里必须是true,因为async插件要用) react的例外就是使用了generator。 我还是倾向于用runtime,这样可以减少额外的帮助代码

脚本

npm run dev 测试开发环境打包 npm run product 测试生产环境打包 npm run jest测试单元测试环境打包

对应babel-preset-zcs npm包