@sentry/gatsby 6.14.0 → 6.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/gatsby-node.js +29 -0
  2. package/package.json +6 -5
package/gatsby-node.js CHANGED
@@ -1,5 +1,7 @@
1
1
  const fs = require('fs');
2
2
 
3
+ const SentryWebpackPlugin = require('@sentry/webpack-plugin');
4
+
3
5
  const sentryRelease = JSON.stringify(
4
6
  // Always read first as Sentry takes this as precedence
5
7
  process.env.SENTRY_RELEASE ||
@@ -29,6 +31,33 @@ exports.onCreateWebpackConfig = ({ plugins, getConfig, actions }) => {
29
31
  ],
30
32
  });
31
33
 
34
+ if (process.env.NODE_ENV === 'production') {
35
+ actions.setWebpackConfig({
36
+ plugins: [
37
+ new SentryWebpackPlugin({
38
+ // Only include files from the build output directory
39
+ include: 'public',
40
+ // Ignore files that aren't users' source code related
41
+ ignore: [
42
+ 'app-*', // related to Gatsby itself
43
+ 'polyfill-*', // related to polyfills
44
+ 'framework-*', // related to the frameworks (e.g. React)
45
+ 'webpack-runtime-*', // related to Webpack
46
+ ],
47
+ // Handle sentry-cli configuration errors when the user has not done it not to break
48
+ // the build.
49
+ errorHandler(err, invokeErr) {
50
+ const { message } = err;
51
+ if (message.includes('organization slug is required') || message.includes('project slug is required')) {
52
+ return;
53
+ }
54
+ invokeErr(err);
55
+ },
56
+ }),
57
+ ],
58
+ });
59
+ }
60
+
32
61
  // To configure the SDK, SENTRY_USER_CONFIG is prioritized over `gatsby-config.js`,
33
62
  // since it isn't possible to set non-serializable parameters in the latter.
34
63
  // Prioritization here means what `init` is run.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/gatsby",
3
- "version": "6.14.0",
3
+ "version": "6.15.0",
4
4
  "description": "Official Sentry SDK for Gatsby.js",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/gatsby",
@@ -26,14 +26,15 @@
26
26
  "access": "public"
27
27
  },
28
28
  "dependencies": {
29
- "@sentry/react": "6.14.0",
30
- "@sentry/tracing": "6.14.0"
29
+ "@sentry/react": "6.15.0",
30
+ "@sentry/tracing": "6.15.0",
31
+ "@sentry/webpack-plugin": "1.18.3"
31
32
  },
32
33
  "peerDependencies": {
33
- "gatsby": "^2.0.0 || ^3.0.0"
34
+ "gatsby": "^2.0.0 || ^3.0.0 || ^4.0.0"
34
35
  },
35
36
  "devDependencies": {
36
- "@sentry/types": "6.14.0",
37
+ "@sentry/types": "6.15.0",
37
38
  "@testing-library/react": "^10.4.9",
38
39
  "jest": "^24.7.1",
39
40
  "npm-run-all": "^4.1.2",