Skip to content

Commit

Permalink
Improve Sentry integration
Browse files Browse the repository at this point in the history
  • Loading branch information
SAPikachu committed Feb 7, 2022
1 parent dc725c1 commit a57110f
Show file tree
Hide file tree
Showing 7 changed files with 282 additions and 92 deletions.
1 change: 0 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
REACT_APP_VERSION=$COMMIT_REF
INLINE_RUNTIME_CHUNK=false
27 changes: 27 additions & 0 deletions .rescriptsrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,34 @@ const { prependWebpackPlugin, getPaths, edit } = require("@rescripts/utilities")
const { RetryChunkLoadPlugin } = require("webpack-retry-chunk-load-plugin");
const isBabelLoader = (inQuestion) => inQuestion && inQuestion.loader && inQuestion.loader.includes("babel-loader");

if (process.env.NODE_ENV === "production") {
const dayjs = require("dayjs");
dayjs.extend(require("dayjs/plugin/utc"));
const timestamp = dayjs.utc().format("YYYYMMDDHHmm");
process.env.REACT_APP_RELEASE = `${timestamp}-${(process.env.COMMIT_REF || "unknown").slice(0, 7)}`;
} else {
process.env.REACT_APP_RELEASE = "devel";
}

module.exports = [
process.env.NODE_ENV === "production" && process.env.SENTRY_AUTH_TOKEN
? (config) =>
prependWebpackPlugin(
new (require("@sentry/webpack-plugin"))({
validate: true,
include: ".",
ignore: ["node_modules", ".rescriptsrc.js", "generatePreloadHeaders.js"],
ext: ["js", "jsx", "ts", "tsx", "map", "jsbundle", "bundle"],
release: process.env.REACT_APP_RELEASE,
...(process.env.SENTRY_URL ? { url: process.env.SENTRY_URL } : {}),
setCommits: {
auto: true,
ignoreMissing: true,
},
}),
config
)
: (x) => x,
process.env.RUN_ANALYZER
? (config) => prependWebpackPlugin(new (require("webpack-bundle-analyzer").BundleAnalyzerPlugin)(), config)
: (x) => x,
Expand Down
Loading

0 comments on commit a57110f

Please sign in to comment.