New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@newrelic/webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@newrelic/webpack-plugin

An experimental plugin to allow New Relic's NodeJS Agent to work with webpack compiled server side javascript.

  • 0.4.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
decreased by-73.92%
Maintainers
1
Weekly downloads
 
Created
Source

New Relic Webpack Plugin

An experimental plugin to allow New Relic's NodeJS Agent to work with webpack compiled server side javascript. This plugin does not instrument any frontend javascript frameworks -- please see New Relic's browser agent documentation for more information on monitoring frontend javascript frameworks.

Quick Start

Add the plugin to your project

$ npm install @newrelic/webpack-plugin

and then add and externals and plugins section to your webpack configuration like this.

/*...*/

const nodeExternals = require('@newrelic/webpack-plugin/lib/externals')
const NewrelicWebpackPlugin = require('@newrelic/webpack-plugin/lib/NewrelicWebpackPlugin')

module.exports = {
  /* ... */
  externals: [nodeExternals()],
  plugins: [
    new NewrelicWebpackPlugin()
  ]
  /* ... */
}

How This Works

In order to use Newrelic's NodeJS agent with webpack, you'll need to

  1. Ensure the modules New Relic instruments are listed as webpack externals.
  2. Add require('newrelic') to the top of your generated sources.

This package allows you to do both. The nodeExternals function

const nodeExternals = require('newrelic-webpack-plugin/lib/externals')

/* ... */

module.exports = {
  /* ... */
  externals: [nodeExternals()],
  /* ... */
}

is borrowed from webpack-node-externals, which is the de-facto standard way to use webpack with NodeJS server side projects. If a module the agent instruments is not listed as a webpack external, the agent will not function properly.

The NewrelicWebpackPlugin

const NewrelicWebpackPlugin = require('newrelic-webpack-plugin/lib/NewrelicWebpackPlugin')

module.exports = {
  /* ... */
  plugins: [
    new NewrelicWebpackPlugin()
  ]
  /* ... */
}

ensures that a require('newrelic') statment is added to the top of any .js asset file generated by webpack.

FAQs

Package last updated on 03 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc