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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@carrotwu/check-conflict-babel-plugin

v1.0.3

Published

用于检测react render模板中是否存在未处理的合并冲突遗留代码

Readme

check-conflict-babel-plugin

[![NPM Version][npm-image]][npm-url]

一个能够检测react渲染函数中(render)是否有合并冲突遗留代码的babel插件

安装

npm install @carrotwu/check-conflict-babel-plugin -D
or
yarn add @carrotwu/check-conflict-babel-plugin -D

使用

使用的方式十分简单,只需要在babel配置中的babel插件配置中引入当前插件即可。

cra中使用

下面展示在create-react-app中如何使用当前插件

因为create-react-app需要自定义配置的话有两种方式:

  1. 通过eject的方式把配置暴露出来
  2. 通过社区的customize-cra库进行配置覆盖

这里仅仅展示第二种方式的插件安装,customize-cra的具体安装方式可以查看具体的官网即可。

config-overrides.js相关配置如下:

const { override, addBabelPlugins } = require('customize-cra');
const checkReactConflictBabelPlugin = require('@carrotwu/check-conflict-babel-plugin')

const isProduction = process.env.NODE_ENV === 'production'
module.exports = {
  webpack: override(
    // 生产模式才启用当前插件
    isProduction && addBabelPlugins(checkReactConflictBabelPlugin)
  )
};

插件是如何检测冲突代码的呢

我们都知道的是在react中,所有的jsx代码最终都会被react转移成react.createElement的代码形式,所以我们只需要通过babel对生成的语法树做语法分析即可。这样子我们就能获取到渲染函数中的合并冲突代码。如果想更加深入的了解插件的内在原理,可以查看我之前写的一篇博客文章