2019-10-09 16:22:46 -06:00
|
|
|
/* eslint-disable */
|
2019-10-07 17:11:53 -06:00
|
|
|
const WorkerLoaderPlugin = require('craco-worker-loader');
|
|
|
|
const SentryPlugin = require('craco-sentry-plugin');
|
2019-09-26 16:22:56 -06:00
|
|
|
|
2019-10-07 17:11:53 -06:00
|
|
|
module.exports = function ({ env }) {
|
|
|
|
const plugins = [
|
2019-10-06 15:10:45 -06:00
|
|
|
{
|
|
|
|
plugin: WorkerLoaderPlugin
|
|
|
|
}
|
|
|
|
];
|
2021-10-04 10:57:54 -06:00
|
|
|
if (process.env.NODE_ENV === 'production' && process.env.SENTRY_AUTH_TOKEN) {
|
2019-11-06 15:38:51 -07:00
|
|
|
plugins.push({
|
|
|
|
plugin: SentryPlugin
|
|
|
|
});
|
2019-10-06 15:10:45 -06:00
|
|
|
}
|
2019-09-26 16:22:56 -06:00
|
|
|
return {
|
2019-10-07 17:11:53 -06:00
|
|
|
plugins,
|
2019-10-10 19:24:06 -06:00
|
|
|
jest: {
|
|
|
|
configure: (jestConfig, { env, paths }) => {
|
|
|
|
jestConfig.testPathIgnorePatterns = ['node_modules', '__puppeteer__'];
|
|
|
|
return jestConfig;
|
|
|
|
}
|
|
|
|
},
|
2019-09-26 16:22:56 -06:00
|
|
|
webpack: {
|
2019-10-06 15:10:45 -06:00
|
|
|
configure: (webpackConfig, { env, paths }) => {
|
2019-10-07 17:11:53 -06:00
|
|
|
webpackConfig.output.globalObject = 'this';
|
2019-10-06 15:10:45 -06:00
|
|
|
webpackConfig.optimization.minimizer = webpackConfig.optimization.minimizer.map(
|
2019-10-07 17:11:53 -06:00
|
|
|
(plugin) => {
|
|
|
|
if (plugin.constructor.name !== 'TerserPlugin') {
|
2019-10-06 15:10:45 -06:00
|
|
|
return plugin;
|
|
|
|
}
|
|
|
|
plugin.options.terserOptions.keep_fnames = true;
|
|
|
|
return plugin;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
return webpackConfig;
|
2019-09-26 16:22:56 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|