зеркало из
1
0
Форкнуть 0
Webpack plugins for common Bugsnag actions.
Перейти к файлу
Ben Gourley 4af27fb29e feat: Add whitelist of extensions to upload (defaults to [ '.js' ] )
CSS files (and maps for them) were being uploaded for no good reason. This feature adds a whitelist
of bundle file extensions to upload source maps for. It is unlikely that anyone will ever need
anything but ".js" but the option is there just in case.

Fixes #24.
2019-01-14 10:31:01 +00:00
bin ci: Only install css plugins for webpack v4 2018-06-26 16:05:11 +01:00
test feat: Add whitelist of extensions to upload (defaults to [ '.js' ] ) 2019-01-14 10:31:01 +00:00
.gitignore WIP 2018-01-10 14:57:04 +00:00
.travis.yml ci: Webpack v4 does not support node v4 2018-06-07 16:08:28 +01:00
CHANGELOG.md chore: Update changelog 2018-12-14 16:19:55 +00:00
CONTRIBUTING.md Polish/documentation for release 2018-01-12 15:33:59 +00:00
LICENSE.txt Polish/documentation for release 2018-01-12 15:33:59 +00:00
README.md Fix readme 2018-02-21 16:44:27 +00:00
build-reporter-plugin.js feat: Webpack v4 support 2018-06-07 15:41:10 +01:00
index.js Add source map upload plugin 2018-02-19 15:57:55 +00:00
package-lock.json 1.2.4 2018-12-14 16:19:58 +00:00
package.json 1.2.4 2018-12-14 16:19:58 +00:00
source-map-uploader-plugin.js feat: Add whitelist of extensions to upload (defaults to [ '.js' ] ) 2019-01-14 10:31:01 +00:00

README.md

webpack-bugsnag-plugins

Build status NPM

Webpack plugins for common Bugsnag actions.

Installation

npm install --save-dev webpack-bugsnag-plugins

Plugins

new BugsnagBuildReporterPlugin(build, opts):WebpackPlugin

const { BugsnagBuildReporterPlugin } = require('webpack-bugsnag-plugins')

Reports your application's build to Bugsnag. It can auto detect source control from .git, .hg and package.json. This plugin hooks into the 'after-emit' event once all output files have been generated by the Webpack compiler. If anything causes the compilation to fail before this step, the build report will not get sent.

  • build describes the build you are reporting to Bugsnag
    • apiKey: string your Bugsnag API key [required]
    • appVersion: string the version of the application you are building [required]
    • releaseStage: string 'production', 'staging' etc. (leave blank if this build can be released to different releaseStages)
    • sourceControl: object an object describing the source control of the build (if not specified, the module will attempt to detect source control information from .git, .hg and the nearest package.json)
      • provider: string can be one of: 'github', 'github-enterprise', 'gitlab', 'gitlab-onpremise', 'bitbucket', 'bitbucket-server'
      • repository: string a URL (git/ssh/https) pointing to the repository, or webpage representing the repository
      • revision: string the unique identifier for the commit (e.g. git SHA)
    • builderName: string the name of the person/machine that created this build (defaults to the result of the whoami command)
    • autoAssignRelease: boolean automatically associate this build with any new error events and sessions that are received for the releaseStage until a subsequent build notification is received. If this is set to true and no releaseStage is provided the build will be applied to 'production'.
  • opts
    • logLevel: string the minimum severity of log to output ('debug', 'info', 'warn', 'error'), default 'warn'
    • logger: object provide a different logger object { debug, info, warn, error }
    • path: string the path to search for source control info, defaults to process.cwd()
    • endpoint: string post the build payload to a URL other than the default (https://build.bugsnag.com)

Usage

const { BugsnagBuildReporterPlugin } = require('webpack-bugsnag-plugins')

module.exports = {
  entry: './app.js',
  output: {
    path: __dirname,
    filename: './bundle.js'
  },
  plugins: [].concat(
    // It's a good idea to only run this plugin when you're building a bundle
    // that will be released, rather than for every development build
    isDistEnv
      ? new BugsnagBuildReporterPlugin({
          apiKey: 'YOUR_API_KEY',
          appVersion: '1.2.3'
        }, { /* opts */ })
      : []
  )
}

new BugsnagSourceMapUploaderPlugin(opts):WebpackPlugin

const { BugsnagSourceMapUploaderPlugin } = require('webpack-bugsnag-plugins')

Upload your application's sourcemap(s) to Bugsnag. When Webpack is done producing output, this plugin detects sourcemaps for any output chunks and uploads them to Bugsnag.

  • opts provide options to the sourcemap uploader
    • apiKey: string your Bugsnag API key [required]
    • publicPath: string the path to your bundled assets (as the browser will see them). This option must either be provided here, or as output.publicPath in your Webpack config.
    • appVersion: string the version of the application you are building
    • overwrite: boolean whether you want to overwrite previously uploaded sourcemaps
    • endpoint: string post the build payload to a URL other than the default (https://upload.bugsnag.com)

Usage

const { BugsnagSourceMapUploaderPlugin } = require('webpack-bugsnag-plugins')

module.exports = {
  entry: './app.js',
  devtool: 'source-map',
  output: {
    path: __dirname,
    filename: './bundle.js',
    publicPath: 'https://your-app.xyz/assets/'
  },
  plugins: [].concat(
    // It's a good idea to only run this plugin when you're building a bundle
    // that will be released, rather than for every development build
    isDistEnv
      ? new BugsnagSourceMapUploaderPlugin({
          apiKey: 'YOUR_API_KEY',
          appVersion: '1.2.3'
        })
      : []
  )
}

Support

Contributing

All contributors are welcome! See our contributing guide.

License

This module is free software released under the MIT License. See LICENSE.txt for details.