This is a webpack plugin to upload javascript sourcemaps to Honeybadger's API endpoint for source maps.
Word Up! to the thredUP development team for a similar webpack plugin they have authored.
Installing via Node.js
npm install @honeybadger-io/webpack --save-dev
These plugin parameters correspond to the Honeybadger Sourcemap API.
apiKey
(required)- The API key of your Honeybadger project
assetsUrl
(required)- The base URL to production assets (scheme://host/path)
*
wildcards are supported. The plugin combinesassetsUrl
with the generated minified js file name to build the API parameterminified_url
revision
(optional — default: "master")- The deploy revision (i.e. commit sha) that your source map applies to. This could also be a code version. For best results, set it to something unique every time your code changes.
silent
(optional — default: "null/false")- If true, silence log information emitted by the plugin.
ignoreErrors
(optional — default: "null/false")- If true, webpack compilation errors are treated as warnings.
const HoneybadgerSourceMapPlugin = require('@honeybadger-io/webpack')
const ASSETS_URL = 'https://cdn.example.com/assets';
const webpackConfig = {
plugins: [new HoneybadgerSourceMapPlugin({
apiKey: 'abc123',
assetsUrl: ASSETS_URL,
revision: 'master'
})]
}
const { environment } = require('@rails/webpacker')
const HoneybadgerSourceMapPlugin = require('@honeybadger-io/webpack')
// See Heroku notes in README https://github.com/honeybadger-io/honeybadger-rails-webpacker-example
// Assumes Heroku / 12-factor application style ENV variables
// named GIT_COMMIT, HONEYBADGER_API_KEY, ASSETS_URL
const revision = process.env.GIT_COMMIT || 'master'
environment.plugins.append(
'HoneybadgerSourceMap',
new HoneybadgerSourceMapPlugin({
apiKey: process.env.HONEYBADGER_API_KEY,
assetsUrl: process.env.ASSETS_URL,
silent: false,
ignoreErrors: false,
revision: revision
}))
module.exports = environment
See example Rails 5 application https://github.com/honeybadger-io/honeybadger-rails-webpacker-example
- Fork it.
- Create a topic branch
git checkout -b my_branch
- Commit your changes
git commit -am "Boom"
- Push to your branch
git push origin my_branch
- Send a pull request
Install the required npm packages with npm install
. Write code. Run tests npm test
. Repeat.
After that you can
The Honeybadger's Webpack Source Map Plugin is MIT licensed. See the MIT-LICENSE file in this repository for details.