{"id":20713,"library":"webpack-bugsnag-plugins","title":"webpack-bugsnag-plugins","description":"Webpack plugins for reporting builds and uploading source maps to Bugsnag error monitoring. Current stable version is 2.2.3, released 2024 with maintenance updates. These plugins integrate Bugsnag's CLI for source map upload and build reporting directly into the Webpack build pipeline. Key differentiator: seamless integration with webpack 3/4/5, automatic source control detection from .git/.hg/package.json, and configurable log levels. Replaces manual invocation of @bugsnag/cli. Suitable for production builds to ensure stack traces are deobfuscated and build metadata is captured.","status":"active","version":"2.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/bugsnag/webpack-bugsnag-plugins","tags":["javascript","bugsnag","webpack"],"install":[{"cmd":"npm install webpack-bugsnag-plugins","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-bugsnag-plugins","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-bugsnag-plugins","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required; plugins are Webpack plugins and need the webpack compiler instance","package":"webpack","optional":false}],"imports":[{"note":"Named export, not default. ESM/CJS compatible.","wrong":"import BugsnagBuildReporterPlugin from 'webpack-bugsnag-plugins'","symbol":"BugsnagBuildReporterPlugin","correct":"import { BugsnagBuildReporterPlugin } from 'webpack-bugsnag-plugins'"},{"note":"CommonJS require with destructuring. Do not assign the whole module.","wrong":"let BugsnagSourceMapUploaderPlugin = require('webpack-bugsnag-plugins')","symbol":"BugsnagSourceMapUploaderPlugin","correct":"const { BugsnagSourceMapUploaderPlugin } = require('webpack-bugsnag-plugins')"},{"note":"First argument must be an object, not separate strings. Since v2.","wrong":"new BugsnagBuildReporterPlugin('YOUR_KEY', '1.0.0')","symbol":"WebpackPlugin","correct":"new BugsnagBuildReporterPlugin({ apiKey: 'YOUR_KEY', appVersion: '1.0.0' })"}],"quickstart":{"code":"// webpack.config.js\nconst { BugsnagBuildReporterPlugin, BugsnagSourceMapUploaderPlugin } = require('webpack-bugsnag-plugins');\n\nconst isDistEnv = process.env.NODE_ENV === 'production';\n\nmodule.exports = {\n  entry: './app.js',\n  output: {\n    path: __dirname,\n    filename: 'bundle.js'\n  },\n  plugins: [\n    isDistEnv && new BugsnagBuildReporterPlugin({\n      apiKey: process.env.BUGSNAG_API_KEY,\n      appVersion: require('./package.json').version,\n      releaseStage: 'production'\n    }),\n    isDistEnv && new BugsnagSourceMapUploaderPlugin({\n      apiKey: process.env.BUGSNAG_API_KEY,\n      appVersion: require('./package.json').version,\n      publicPath: 'https://example.com/js',\n      overwrite: true\n    })\n  ].filter(Boolean)\n};","lang":"javascript","description":"Minimal webpack config using both plugins for production builds. Filters out plugins when not in dist mode."},"warnings":[{"fix":"Upgrade to v2+ and ensure @bugsnag/cli is in devDependencies. See CHANGELOG.","message":"v2.0.0 migrated from @bugsnag/source-maps and @bugsnag/build-reporter to @bugsnag/cli. Existing users of pre-2.0 must update configuration and install @bugsnag/cli as a peer dependency.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Upgrade to v2.1.0 or later to use overwrite option.","message":"The 'overwrite' option for source map upload was added in v2.1.0. In v2.0.0, it is not available.","severity":"gotcha","affected_versions":"2.0.0"},{"fix":"Check webpack compilation result; ensure plugin runs only after successful builds.","message":"The build reporter will not send a report if compilation fails before the 'after-emit' hook. This can lead to missing builds in Bugsnag dashboard.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass an object: new BugsnagBuildReporterPlugin({ apiKey: ..., appVersion: ... })","message":"Using separate 'apiKey' and 'appVersion' as two function arguments was deprecated in v1.x and removed in v2. Use a single options object.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Explicitly set releaseStage or autoAssignRelease to true.","message":"If you don't set 'releaseStage' in build reporter, the build will not auto-assign unless you set 'autoAssignRelease: true'.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install --save-dev @bugsnag/cli","cause":"Missing peer dependency @bugsnag/cli (required since v2.0.0).","error":"Error: Cannot find module '@bugsnag/cli'"},{"fix":"Use const { BugsnagBuildReporterPlugin } = require('webpack-bugsnag-plugins'); or import { BugsnagBuildReporterPlugin } from 'webpack-bugsnag-plugins';","cause":"Using default import instead of named import.","error":"TypeError: BugsnagBuildReporterPlugin is not a constructor"},{"fix":"new BugsnagBuildReporterPlugin({ apiKey: '...', appVersion: '...' })","cause":"Passed apiKey and appVersion as separate arguments instead of an object.","error":"Error: Plugin could not be instantiated: invalid options"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}