-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraco.config.js
48 lines (46 loc) · 1.12 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
const CracoLessPlugin = require('craco-less');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const OpenBrowserPlugin = require("open-browser-webpack-plugin");
const path = require("path");
const TerserPlugin = require('terser-webpack-plugin');
const tsConfigPath = path.resolve(__dirname, "./tsconfig.json")
module.exports = {
reactScriptsVersion: "react-scripts",
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: {},
javascriptEnabled: true,
},
},
},
},
{ plugin: new OpenBrowserPlugin({ url: "http://localhost:3000" }) },
],
webpack: {
configure: (webpackConfig) => {
webpackConfig.optimization.minimizer = [
new TerserPlugin({
cache: true,
parallel: true,
sourceMap: true, // Must be set to true if using source-maps in production
terserOptions: {
compress: {
drop_console: true,
},
},
}),
];
return webpackConfig;
},
alias: {
"@": path.resolve(__dirname, "src")
},
plugins: [
new TsconfigPathsPlugin({ configFile: tsConfigPath })
],
}
};