@edx/new-relic-source-map-webpack-plugin

中文文档
2.1.0发布于 2023/05/23AGPL-3.0CommonJS近 30 天下载 3.5万

Upload source maps to new relic as part of a webpack build.

原始使用文档
文档目录4 节
  1. new-relic-source-map-webpack-plugin
  2. Install
  3. Setup
  4. Customize

new-relic-source-map-webpack-plugin

Upload source maps to new relic as part of a webpack build.

Install

npm install @edx/new-relic-source-map-webpack-plugin --save-dev

Setup

Instantiate the plugin and add it to your plugins array.

applicationId, apiKey, and staticAssetUrl are required unless noop is true. Full list of options in the next section.

const NewRelicSourceMapPlugin = require('new-relic-source-map-webpack-plugin');

module.exports = {
    ...webpackConfig,
    plugins: [
        ...yourPlugins,
        new NewRelicSourceMapPlugin({
            applicationId: 'YOUR NEW RELIC APP ID',
            apiKey: process.env.NEW_RELIC_ADMIN_KEY,
            staticAssetUrl: 'http://examplecdn.com',
            noop: typeof process.env.NEW_RELIC_ADMIN_KEY === 'undefined', // upload source maps in prod builds only
        })
    ]   
}

If you're using releaseName and releaseId, make sure one or both are unique per build and that you use the newrelic.addRelease method in your code to identify the release.

Customize

PropertyTypeDescription
applicationIdstringapplicationId as defined here
apiKeystringAPI Key as defined here
staticAssetUrlstringthe domain your production assets are served from. Written as a complete url. Example: "https://www.examplecdn.com"
staticAssetUrlBuilderfunctionA function for building the production url your js file is built from. Will be called for every javascript file with four arguments: staticAssetUrl, the public path from your webpack config, the filename, and the webpack stats instance. Defaults to ${removeLastCharIfSlash(url)}${removeLastCharIfSlash(publicPath)}/${file}
extensionRegexregexa regex used to find js files. Defaults to /\.js$/
noopbooleancontrol boolean that decides whether or not to run the plugin. Set to true for builds where you don't want to upload assets to new relic.
releaseNamestring[Optional] unique identifier for the release name
releaseIdstring[Optional] unique version for the release identifier
errorCallbackfunction[Optional] A function for error callback. Default is console.warn(`New Relic sourcemap upload error: ${err}`)

版本与发布记录

@edx/new-relic-source-map-webpack-plugin 共发布 5 个版本,首次发布于 2021/08/20;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.1.0latest2023/05/233 年前
2.0.02022/06/024 年前
1.0.22022/02/244 年前
1.0.12021/10/195 年前
1.0.02021/08/205 年前

关于 @edx/new-relic-source-map-webpack-plugin 的常见问题

@edx/new-relic-source-map-webpack-plugin 是什么?

Upload source maps to new relic as part of a webpack build.

如何安装 @edx/new-relic-source-map-webpack-plugin?

在项目目录运行 npm install @edx/new-relic-source-map-webpack-plugin,或使用 pnpm add / yarn add / bun add。

@edx/new-relic-source-map-webpack-plugin 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/edx__new-relic-source-map-webpack-plugin 是否存在。

@edx/new-relic-source-map-webpack-plugin 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@edx/new-relic-source-map-webpack-plugin 可以商用吗?

@edx/new-relic-source-map-webpack-plugin 使用 AGPL-3.0 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@edx/new-relic-source-map-webpack-plugin 的下载量有多少?

根据 npm 官方下载统计,@edx/new-relic-source-map-webpack-plugin 在 2026/10/13 – 2026/11/11 这 30 天内被下载 34,721 次,日均约 1,157 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@edx/new-relic-source-map-webpack-plugin 还在维护吗?

最新版本 2.1.0 发布于 2023/05/23(3 年前);至今共发布 5 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/08/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。