{"id":20823,"library":"webpack-sentry-plugin","title":"webpack-sentry-plugin","description":"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).","status":"active","version":"2.0.3","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/40thieves/webpack-sentry-plugin","tags":["javascript","sentry","webpack","upload","source-map"],"install":[{"cmd":"npm install webpack-sentry-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-sentry-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-sentry-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency (^4 || ^5)","package":"webpack","optional":false}],"imports":[{"note":"Package does not ship ES modules; must use CommonJS require().","wrong":"import SentryPlugin from 'webpack-sentry-plugin';","symbol":"SentryPlugin","correct":"const SentryPlugin = require('webpack-sentry-plugin');"},{"note":"Default export is the plugin constructor. No named exports.","wrong":"import * as SentryPlugin from 'webpack-sentry-plugin';","symbol":"default","correct":"const SentryPlugin = require('webpack-sentry-plugin');"},{"note":"No named export exists. Only default export.","wrong":"","symbol":"SentryPlugin","correct":"const { SentryPlugin } = require('webpack-sentry-plugin');"}],"quickstart":{"code":"const SentryPlugin = require('webpack-sentry-plugin');\n\nmodule.exports = {\n  devtool: 'source-map',\n  plugins: [\n    new SentryPlugin({\n      organization: 'my-org',\n      project: 'my-project',\n      apiKey: process.env.SENTRY_AUTH_TOKEN || '',\n      release: process.env.GIT_SHA || 'dev-release',\n      include: /\\.js$/\n    })\n  ]\n};","lang":"javascript","description":"Configures webpack to output source maps and upload them to Sentry via the plugin."},"warnings":[{"fix":"If using webpack 1-3, stick with v1.x (latest 1.16.0). v2.0.0 removed webpack 1-3 support.","message":"v2.0.0 requires webpack >= 4 and Node >= 6. API changed to use webpack 4 hooks.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use a Sentry auth token instead of an API key. Generate from Sentry UI with 'project:releases' scope.","message":"Configuration option 'apiKey' accepts both Sentry auth tokens and deprecated API keys. Sentry deprecated API keys in favor of auth tokens.","severity":"deprecated","affected_versions":"all"},{"fix":"Ensure baseSentryURL does not end with '/projects'.","message":"Option 'baseSentryURL' previously required trailing '/projects' but now should be provided without it (e.g. 'https://sentry.io/api/0').","severity":"deprecated","affected_versions":">=1.12.0"},{"fix":"Use process.env.GIT_SHA or a function returning (hash) => `release-${hash}`.","message":"The 'release' option can be a function receiving the compilation hash. Commonly misused as a string that is not unique per build.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure transformed paths begin with '~/' if you want Sentry's host wildcard matching.","message":"Option 'filenameTransform' defaults to prefixing with '~/' for Sentry host wildcard. If you override, you must replicate that behavior if needed.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install webpack-sentry-plugin --save-dev and use require() as package is CommonJS only.","cause":"Package not installed or imported incorrectly in ESM context.","error":"Error: Cannot find module 'webpack-sentry-plugin'"},{"fix":"Change to const SentryPlugin = require('webpack-sentry-plugin');","cause":"Tried to use ES6 import syntax (e.g., import SentryPlugin from ...) which is not supported.","error":"TypeError: webpack_sentry_plugin is not a constructor"},{"fix":"Check SENTRY_AUTH_TOKEN env var is set and token has project:releases scope.","cause":"Invalid or missing Sentry auth token or API key.","error":"Unhandled rejection: Error: Request failed with status code 401"},{"fix":"Match plugin version to webpack version: v1 for webpack 1-3, v2 for webpack 4-5.","cause":"Using webpack 3 with v2 of the plugin, or using v1 with webpack 4.","error":"SentryPlugin is not a plugin: Only 'tap', 'tapAsync', 'tapPromise' hooks are allowed.","affected_versions":">=2.0.0"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}