PromucFlow_constructor/app/client/craco.build.config.js
Hetu Nandu 39b0a4e5a6
feat: Native promises support in Appsmith (#8988)
Co-authored-by: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com>
2021-12-23 14:17:20 +00:00

55 lines
1.3 KiB
JavaScript

/* eslint-disable @typescript-eslint/no-var-requires */
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
const merge = require("webpack-merge");
const common = require("./craco.common.config.js");
const WorkboxPlugin = require("workbox-webpack-plugin");
const env = process.env.REACT_APP_ENVIRONMENT;
const plugins = [];
plugins.push(
new WorkboxPlugin.InjectManifest({
swSrc: "./src/serviceWorker.js",
mode: "development",
swDest: "./pageService.js",
maximumFileSizeToCacheInBytes: 7 * 1024 * 1024,
}),
);
if (env === "PRODUCTION" || env === "STAGING") {
if (
process.env.SENTRY_AUTH_TOKEN != null &&
process.env.SENTRY_AUTH_TOKEN !== ""
) {
plugins.push(
new SentryWebpackPlugin({
include: "build",
ignore: ["node_modules", "webpack.config.js"],
release: process.env.REACT_APP_SENTRY_RELEASE,
deploy: {
env: process.env.REACT_APP_SENTRY_ENVIRONMENT,
},
}),
);
} else {
console.log(
"Sentry configuration missing in process environment. Sentry will be disabled.",
);
}
}
module.exports = merge(common, {
webpack: {
plugins: plugins,
},
jest: {
configure: {
moduleNameMapper: {
// Jest module mapper which will detect our absolute imports.
"^@test(.*)$": "<rootDir>/test$1",
},
},
},
});