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

@1tokenfe/cross-inpage-provider-injected

v2.2.46

Published

Downloads

11

Readme

cross-inpage-provider

cross-inpage-provider

处理第三方库语法兼容性问题

当引入或升级第三方库时,可能会遇到语法兼容性检查失败的情况。这是因为我们的项目使用 syntax-compatibility.eslint.config.cjs 来限制使用较新的 JavaScript 语法特性,以确保更好的浏览器兼容性。

问题表现

  1. ESLint 报错,提示类似:
    • Logical OR assignment (||=) is not allowed
    • String.prototype.replaceAll is not allowed
    • 其他在 syntax-compatibility.eslint.config.cjs 中定义的语法限制

解决步骤

  1. 确认报错来源

    • 检查 ESLint 错误信息,定位是哪个第三方库使用了不兼容的语法
    • 通常这些错误会出现在 node_modules 中的文件
  2. 将库添加到 webpack 配置中

    • 打开 webpack.config.cjs
    • includeModules 数组中添加该库的包名
    const includeModules = [
      // 已有的库
      '@solana/web3.js',
      // 添加新的库
      'your-new-package'
    ];
  3. 验证修复

    • 重新运行构建或开发命令
    • 确认 ESLint 错误已解决

注意事项

  1. 添加到 includeModules 意味着该库的代码将会被 webpack 处理和转换,这可能会:

    • 增加最终打包体积
    • 影响构建速度
    • 确保真的需要添加该库
  2. 替代方案:

    • 考虑使用该库的较低版本(如果可用)
    • 寻找使用较旧语法的替代库
    • 如果可能,考虑自行实现相关功能
  3. 定期审查:

    • 定期检查 includeModules 列表
    • 评估是否所有列出的库仍然需要被包含
    • 考虑是否可以移除一些不再需要的库

相关文件

  • syntax-compatibility.eslint.config.cjs: 定义语法限制规则
  • webpack.config.cjs: 配置需要处理的第三方模块