Skip to content

Commit

Permalink
Merge pull request #5645 from dodona-edu/chor/sentry-production
Browse files Browse the repository at this point in the history
Only upload source maps to sentry in production and staging
  • Loading branch information
jorg-vr authored Jun 26, 2024
2 parents 515f0aa + ad9f78e commit cbe5bc8
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions config/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,6 @@ const config = {
modules: ["node_modules", "app/assets/javascripts"],
extensions: [".tsx", ".ts", ".mjs", ".js", ".sass", ".scss", ".css", ".module.sass", ".module.scss", ".module.css", ".png", ".svg", ".gif", ".jpeg", ".jpg"]
},
devtool: "source-map", // Source map generation must be turned on
plugins: [
// Put the Sentry Webpack plugin after all other plugins
sentryWebpackPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "dodona",
project: "dodona-frontend",
}),
],

};

if (process.env.NODE_ENV === "development") {
Expand All @@ -90,6 +80,20 @@ if (process.env.RAILS_ENV === "test") {
config.optimization.minimize = false;
}

// only enable sentry in production
// as it slows down the build process
if (process.env.NODE_ENV === "production" || process.env.NODE_ENV === "staging") {
config.devtool = "source-map"; // Source map generation must be turned on for sentry to work
config. plugins= [
// Put the Sentry Webpack plugin after all other plugins
sentryWebpackPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "dodona",
project: "dodona-frontend",
}),
];
}

// Test, Staging and Production use default config

module.exports = config;

0 comments on commit cbe5bc8

Please sign in to comment.