Registry / devops / webpack-sentry-plugin

webpack-sentry-plugin

JSON →
library2.0.3jsnpmunverified

Webpack plugin to upload source maps to Sentry for error tracking. Current stable version 2.0.3 supports webpack 4 & 5 and Node >= 6. Works by creating Sentry releases and uploading source maps automatically during the webpack build. Key differentiator: integrates directly with webpack's compilation lifecycle, supports release commits, filename transforms, and include/exclude filters. v2 rewrote the plugin API for webpack 4 hooks, breaking compatibility with webpack 1-3 (use v1 for those).

npm install webpack-sentry-plugin
INSTALL
IMPORT
SIG · WEBPACK-SENTRY-PLU
W
webpack-sentry-plugin
devopsjavascriptv2.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SentryPlugin
const SentryPlugin = require('webpack-sentry-plugin');
import SentryPlugin from 'webpack-sentry-plugin';
Package does not ship ES modules; must use CommonJS require().
default
const SentryPlugin = require('webpack-sentry-plugin');
import * as SentryPlugin from 'webpack-sentry-plugin';
Default export is the plugin constructor. No named exports.
SentryPlugin
const { SentryPlugin } = require('webpack-sentry-plugin');
No named export exists. Only default export.

Configures webpack to output source maps and upload them to Sentry via the plugin.

const SentryPlugin = require('webpack-sentry-plugin'); module.exports = { devtool: 'source-map', plugins: [ new SentryPlugin({ organization: 'my-org', project: 'my-project', apiKey: process.env.SENTRY_AUTH_TOKEN || '', release: process.env.GIT_SHA || 'dev-release', include: /\.js$/ }) ] };
Debug
Known issues
breakingv2.0.0 requires webpack >= 4 and Node >= 6. API changed to use webpack 4 hooks.
fix
If using webpack 1-3, stick with v1.x (latest 1.16.0). v2.0.0 removed webpack 1-3 support.
affects: >=2.0.0
deprecatedConfiguration option 'apiKey' accepts both Sentry auth tokens and deprecated API keys. Sentry deprecated API keys in favor of auth tokens.
fix
Use a Sentry auth token instead of an API key. Generate from Sentry UI with 'project:releases' scope.
affects: all
deprecatedOption 'baseSentryURL' previously required trailing '/projects' but now should be provided without it (e.g. 'https://sentry.io/api/0').
fix
Ensure baseSentryURL does not end with '/projects'.
affects: >=1.12.0
gotchaThe 'release' option can be a function receiving the compilation hash. Commonly misused as a string that is not unique per build.
fix
Use process.env.GIT_SHA or a function returning (hash) => `release-${hash}`.
affects: all
gotchaOption 'filenameTransform' defaults to prefixing with '~/' for Sentry host wildcard. If you override, you must replicate that behavior if needed.
fix
Ensure transformed paths begin with '~/' if you want Sentry's host wildcard matching.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'webpack-sentry-plugin'
Package not installed or imported incorrectly in ESM context.
fix
npm install webpack-sentry-plugin --save-dev and use require() as package is CommonJS only.
TypeError: webpack_sentry_plugin is not a constructor
Tried to use ES6 import syntax (e.g., import SentryPlugin from ...) which is not supported.
fix
Change to const SentryPlugin = require('webpack-sentry-plugin');
Unhandled rejection: Error: Request failed with status code 401
Invalid or missing Sentry auth token or API key.
fix
Check SENTRY_AUTH_TOKEN env var is set and token has project:releases scope.
SentryPlugin is not a plugin: Only 'tap', 'tapAsync', 'tapPromise' hooks are allowed.
Using webpack 3 with v2 of the plugin, or using v1 with webpack 4.
fix
Match plugin version to webpack version: v1 for webpack 1-3, v2 for webpack 4-5.
Upgrade
Version history
2.0.3latest on npm
Audit
Dependencies
webpackrequiredpeer dependency (^4 || ^5)
Agent activity
40 hits · last 30 days
node
34
OpenAI (training)
1
Resources
webpack-sentry-plugin — npm install webpack-sentry-plugin · libregistry