-
Notifications
You must be signed in to change notification settings - Fork 10
/
webpack.base.prod.config.js
36 lines (30 loc) · 1.16 KB
/
webpack.base.prod.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
const packageJson = require("./package.json");
const webpack = require("webpack");
const plugins = [
new webpack.DefinePlugin({
"process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN || ""),
"process.env.SENTRY_ORG": JSON.stringify(process.env.SENTRY_ORG || "nodefactory"),
"process.env.SENTRY_PROJECT": JSON.stringify(process.env.SENTRY_PROJECT || "chainguardian"),
"process.env.SENTRY_AUTH_TOKEN": JSON.stringify(process.env.SENTRY_AUTH_TOKEN || ""),
"process.env.npm_package_version": JSON.stringify(packageJson.version),
}),
];
if(process.env.SENTRY_AUTH_TOKEN) {
// Sentry CLI used for uploading releases
plugins.push(new SentryWebpackPlugin({
// sentry-cli configuration
authToken: process.env.SENTRY_AUTH_TOKEN,
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
errorHandler: () => null,
include: ["dist", "src"],
release: packageJson.version,
}));
} else {
console.warn("Sentry source map not uploaded");
}
module.exports = {
devtool: "source-map",
plugins
};