PromucFlow_constructor/app/client/craco.build.config.js

40 lines
936 B
JavaScript
Raw Normal View History

2020-02-27 11:25:55 +00:00
/* eslint-disable @typescript-eslint/no-var-requires */
2020-04-17 04:59:43 +00:00
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
const merge = require("webpack-merge");
const common = require("./craco.common.config.js");
2020-05-05 12:16:51 +00:00
const WorkboxPlugin = require("workbox-webpack-plugin");
2020-02-27 11:25:55 +00:00
2020-04-17 04:59:43 +00:00
const env = process.env.REACT_APP_ENVIRONMENT;
2020-04-17 04:59:43 +00:00
const plugins = [];
plugins.push(
new WorkboxPlugin.InjectManifest({
swSrc: "./src/serviceWorker.js",
mode: "development",
swDest: "./pageService.js",
maximumFileSizeToCacheInBytes: 4 * 1024 * 1024,
}),
);
2020-04-17 04:59:43 +00:00
if (env === "PRODUCTION" || env === "STAGING") {
plugins.push(
new SentryWebpackPlugin({
include: "build",
ignore: ["node_modules", "webpack.config.js"],
setCommits: {
auto: true
2020-08-28 12:32:50 +00:00
},
deploy: {
2020-08-28 14:34:00 +00:00
env: process.env.REACT_APP_SENTRY_ENVIRONMENT
}
2020-04-17 04:59:43 +00:00
}),
);
}
2020-02-27 11:25:55 +00:00
module.exports = merge(common, {
webpack: {
2020-04-17 04:59:43 +00:00
plugins: plugins,
2020-02-27 11:25:55 +00:00
},
});