webpack-sentry-plugin
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -27,7 +27,2 @@ 'use strict'; | ||
function handleErrors(err, compilation, cb) { | ||
compilation.errors.push('Sentry Plugin: ' + err); | ||
cb(); | ||
} | ||
module.exports = function () { | ||
@@ -47,2 +42,3 @@ function SentryPlugin(options) { | ||
this.filenameTransform = options.filenameTransform || DEFAULT_TRANSFORM; | ||
this.suppressErrors = options.suppressErrors; | ||
} | ||
@@ -59,3 +55,3 @@ | ||
if (errors) { | ||
return handleErrors(errors, compilation, cb); | ||
return _this.handleErrors(errors, compilation, cb); | ||
} | ||
@@ -70,3 +66,3 @@ | ||
}).catch(function (err) { | ||
return handleErrors(err, compilation, cb); | ||
return _this.handleErrors(err, compilation, cb); | ||
}); | ||
@@ -76,2 +72,14 @@ }); | ||
}, { | ||
key: 'handleErrors', | ||
value: function handleErrors(err, compilation, cb) { | ||
var errorMsg = 'Sentry Plugin: ' + err; | ||
if (this.suppressErrors) { | ||
compilation.warnings.push(errorMsg); | ||
} else { | ||
compilation.errors.push(errorMsg); | ||
} | ||
cb(); | ||
} | ||
}, { | ||
key: 'ensureRequiredOptions', | ||
@@ -78,0 +86,0 @@ value: function ensureRequiredOptions() { |
{ | ||
"name": "webpack-sentry-plugin", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Webpack plugin to upload source maps to Sentry", | ||
@@ -14,3 +14,3 @@ "keywords": [ | ||
"build": "babel src --out-dir dist", | ||
"prepublish": "npm test && npm run build", | ||
"prepublish": "npm test && npm run lint && npm run build", | ||
"test": "jest", | ||
@@ -17,0 +17,0 @@ "lint": "eslint src test; exit 0" |
@@ -25,3 +25,3 @@ # Sentry plugin | ||
```js | ||
var SentryPlugin = require('webpack-sentry-plugin'); | ||
var SentryPlugin = require('webpack-sentry-plugin'); | ||
``` | ||
@@ -34,17 +34,17 @@ | ||
```js | ||
var config = { | ||
plugins: [ | ||
new SentryPlugin({ | ||
// Sentry options are required | ||
organisation: 'your-organisation-name', | ||
project: 'your-project-name', | ||
apiKey: process.env.SENTRY_API_KEY, | ||
// Release version name/hash is required | ||
release: function() { | ||
return process.env.GIT_SHA | ||
} | ||
}) | ||
] | ||
} | ||
var config = { | ||
plugins: [ | ||
new SentryPlugin({ | ||
// Sentry options are required | ||
organisation: 'your-organisation-name', | ||
project: 'your-project-name', | ||
apiKey: process.env.SENTRY_API_KEY, | ||
// Release version name/hash is required | ||
release: function() { | ||
return process.env.GIT_SHA | ||
} | ||
}) | ||
] | ||
} | ||
``` | ||
@@ -55,28 +55,29 @@ | ||
- `exclude`: RegExp to match for excluded files | ||
- `suppressErrors`: Display warnings instead of failing webpack build - useful in case webpack compilation is done during deploy on multiple instances | ||
```js | ||
var config = { | ||
plugins: [ | ||
new SentryPlugin({ | ||
// Exclude uploading of html | ||
exclude: /\.html$/, | ||
... | ||
}) | ||
] | ||
} | ||
``` | ||
```js | ||
var config = { | ||
plugins: [ | ||
new SentryPlugin({ | ||
// Exclude uploading of html | ||
exclude: /\.html$/, | ||
... | ||
}) | ||
] | ||
} | ||
``` | ||
- `include`: RegExp to match for included files | ||
```js | ||
var config = { | ||
plugins: [ | ||
new SentryPlugin({ | ||
// Only upload foo.js & foo.js.map | ||
include: /foo.js/, | ||
... | ||
}) | ||
] | ||
} | ||
``` | ||
```js | ||
var config = { | ||
plugins: [ | ||
new SentryPlugin({ | ||
// Only upload foo.js & foo.js.map | ||
include: /foo.js/, | ||
... | ||
}) | ||
] | ||
} | ||
``` | ||
- `filenameTransform`: Function to transform filename before uploading to Sentry | ||
@@ -89,3 +90,3 @@ | ||
filenameTransform: function(filename) { | ||
return `a-filename-prefix-${filename}` | ||
return 'a-filename-prefix-' + filename | ||
} | ||
@@ -92,0 +93,0 @@ }) |
Sorry, the diff of this file is not supported yet
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
@sentry/webpack-plugin |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10694
131
117
1