-
Notifications
You must be signed in to change notification settings - Fork 5
/
craco.config.js
74 lines (73 loc) · 1.97 KB
/
craco.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const TerserPlugin = require("terser-webpack-plugin");
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
const Dotenv = require("dotenv-webpack");
const path = require("path");
module.exports = {
webpack: {
configure: (webpackConfig, { env, paths }) => {
return {
...webpackConfig,
entry: {
main: [
env === "development" &&
require.resolve("react-dev-utils/webpackHotDevClient"),
paths.appIndexJs,
].filter(Boolean),
impersonator: "./src/chrome/impersonator.ts",
inject: "./src/chrome/inject.ts",
},
optimization: {
...webpackConfig.optimization,
minimizer: [
...webpackConfig.optimization.minimizer,
new TerserPlugin({
terserOptions: { keep_classnames: true, keep_fnames: true },
}),
],
},
module: {
...webpackConfig.module,
rules: [
...webpackConfig.module.rules,
{
test: /\.tsx?$/,
use: [
{
loader: "ts-loader",
options: {
compilerOptions: {
noEmit: false,
},
},
},
],
exclude: /node_modules/,
},
],
},
output: {
...webpackConfig.output,
filename: "static/js/[name].js",
},
performance: {
...webpackConfig.performance,
hints: false,
},
plugins: [
...webpackConfig.plugins,
new NodePolyfillPlugin({
excludeAliases: ["console"],
}),
new Dotenv(),
],
resolve: {
...webpackConfig.resolve,
alias: {
...webpackConfig.resolve.alias,
"@": path.resolve(__dirname, "src"),
},
},
};
},
},
};