Registry / devops / rollbar-sourcemap-webpack-plugin

rollbar-sourcemap-webpack-plugin

JSON →
library3.3.0jsnpmunverified

This Webpack plugin automates the upload of generated sourcemaps to Rollbar after a production build. It addresses the challenge of making minified JavaScript stacktraces useful in Rollbar by ensuring the corresponding sourcemaps are always available. The current stable version is 3.3.0, with ongoing development and maintenance indicated by recent badges and version bumps. Its primary differentiator is deep integration with the Webpack build process, abstracting away the manual `curl` requests or shell scripts typically used for sourcemap uploads, thus reducing setup complexity and potential for error. It requires Webpack 4 or higher since version 3.0.0, streamlining the deployment of sourcemaps for error monitoring.

npm install rollbar-sourcemap-webpack-plugin
INSTALL
IMPORT
SIG · ROLLBAR-SOURCEMAP-
R
rollbar-sourcemap-webpack-plugin
devopsjavascriptv3.3.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

RollbarSourceMapPlugin
✓ import RollbarSourceMapPlugin from 'rollbar-sourcemap-webpack-plugin';
✗ import { RollbarSourceMapPlugin } from 'rollbar-sourcemap-webpack-plugin';
The plugin is exported as a default export.
RollbarSourceMapPlugin
✓ const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin');
CommonJS `require` for older Node.js or `webpack.config.js` setups.

This quickstart demonstrates how to configure the plugin in a webpack.config.js to upload sourcemaps for a production build.

const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin'); const path = require('path'); const PUBLIC_PATH = 'https://my.cdn.net/assets'; module.exports = { mode: 'production', devtool: 'hidden-source-map', entry: './src/index.js', output: { path: path.resolve(__dirname, 'dist'), publicPath: PUBLIC_PATH, filename: 'index-[contenthash].js' }, plugins: [ new RollbarSourceMapPlugin({ accessToken: process.env.ROLLBAR_ACCESS_TOKEN ?? 'aaaabbbbccccddddeeeeffff00001111', // Use environment variable in production version: process.env.GIT_SHA ?? 'default-version-123', publicPath: PUBLIC_PATH, includeChunks: ['main'] // Specify chunk name if desired }) ] };
Debug
Known issues
breakingVersion 3.0.0 introduced a breaking change requiring Webpack 4 or higher. Projects using Webpack 3 or older must remain on `rollbar-sourcemap-webpack-plugin` v2.x.
fix
Upgrade Webpack to version 4 or newer, or downgrade `rollbar-sourcemap-webpack-plugin` to a 2.x version compatible with your Webpack setup.
affects: >=3.0.0
gotchaThe `accessToken`, `version`, and `publicPath` options are all required for the plugin to function correctly. Omitting any of these will lead to upload failures.
fix
Ensure `accessToken` (your Rollbar post_server_item token), `version` (a unique string for your code version, e.g., git SHA), and `publicPath` (the base URL for your deployed bundles) are all provided in the plugin configuration.
affects: >=1.0.0
gotchaUsing `devtool: 'hidden-source-map'` is recommended for production builds when using this plugin, as it generates sourcemaps without adding comments to the bundled files, which could expose source map URLs publicly. Other `devtool` options might embed source map references or generate inline sourcemaps which are not suitable for external upload.
fix
Set `devtool: 'hidden-source-map'` in your Webpack configuration for production builds.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: RollbarSourceMapPlugin is not a constructor
Attempting to use named import syntax `import { RollbarSourceMapPlugin }` when the plugin is exported as a default.
fix
Change the import statement to `import RollbarSourceMapPlugin from 'rollbar-sourcemap-webpack-plugin';` for ESM, or `const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin');` for CommonJS.
Error: Missing required option: accessToken (or version/publicPath)
One of the mandatory configuration options (`accessToken`, `version`, or `publicPath`) was not provided to the plugin.
fix
Review the plugin configuration in your `webpack.config.js` and ensure all required options (`accessToken`, `version`, `publicPath`) are present and correctly valued.
Rollbar API Error: 400 Bad Request (or similar upload failure message)
Often caused by an incorrect `accessToken`, an invalid `version` string, or a `publicPath` that doesn't correctly map to the deployed assets on your CDN.
fix
Double-check your Rollbar `post_server_item` access token. Ensure your `version` string is unique and valid. Verify that the `publicPath` configuration matches the exact base URL where your production JavaScript bundles are hosted.
Upgrade
Version history
3.3.0latest on npm
Audit
Dependencies
webpackrequiredRequired peer dependency for Webpack plugin functionality.
Agent activity
30 hits · last 30 days
node
26
OpenAI (training)
3
Resources
rollbar-sourcemap-webpack-plugin — npm install rollbar-sourcemap-webpack-plugin · libregistry