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

react-devtools-guard

v0.1.0

Published

A lightweight React component to make opening DevTools harder in production.

Readme

Devtools Guard (React)

一个用于 生产环境 的轻量 React 组件:

  • 尝试提高打开 DevTools(F12/快捷键/右键)调试的成本
  • 支持定时触发 debugger(会导致按 F8/Resume 后很快再次暂停)
  • 可禁用右键菜单与常见 DevTools 快捷键

重要说明(请务必阅读)

  • 这类“反调试/防查看” 无法真正阻止 有经验的用户(可以被绕过)。
  • 它的定位是 提高成本/劝退,而不是安全方案。
  • 副作用:可能影响开发者/高级用户体验,也可能影响性能。建议仅在生产环境启用,并控制触发频率。

安装

npm i react-devtools-guard
# 或
pnpm add react-devtools-guard
# 或
yarn add react-devtools-guard

使用

在应用根部(例如 React App 的 App 或 Next.js 的 RootLayout client subtree)挂载:

import React from "react";
import { DevtoolsGuard } from "react-devtools-guard";

export default function App() {
  return (
    <>
      <DevtoolsGuard />
      {/* your app */}
    </>
  );
}

API

<DevtoolsGuard />

  • enabled?: boolean

    • true:强制启用
    • false:强制关闭
    • 不传:默认仅 NODE_ENV === 'production' 启用
  • debuggerIntervalMs?: number

    • 触发 debugger 的间隔,默认 200
    • 建议不要太小(比如 50ms 会更卡且更耗)
  • blockContextMenu?: boolean

    • 是否禁用右键菜单,默认 true
    • 组件会放行 input/textarea/select/contenteditable 上的右键,尽量不影响正常输入/复制粘贴

开发

npm install
node -e "console.log(require('./index.js'))"

License

MIT