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-pluginVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure the plugin in a webpack.config.js to upload sourcemaps for a production build.
Upgrade Webpack to version 4 or newer, or downgrade `rollbar-sourcemap-webpack-plugin` to a 2.x version compatible with your Webpack setup.
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.
Set `devtool: 'hidden-source-map'` in your Webpack configuration for production builds.
Change the import statement to `import RollbarSourceMapPlugin from 'rollbar-sourcemap-webpack-plugin';` for ESM, or `const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin');` for CommonJS.Review the plugin configuration in your `webpack.config.js` and ensure all required options (`accessToken`, `version`, `publicPath`) are present and correctly valued.
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.