KumarArpit8649 commited on
Commit
cd7a855
·
verified ·
1 Parent(s): d8b1208

Upload craco.config.js

Browse files
Files changed (1) hide show
  1. craco.config.js +46 -0
craco.config.js ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Load configuration from environment or config file
2
+ const path = require('path');
3
+
4
+ // Environment variable overrides
5
+ const config = {
6
+ disableHotReload: process.env.DISABLE_HOT_RELOAD === 'true',
7
+ };
8
+
9
+ module.exports = {
10
+ webpack: {
11
+ alias: {
12
+ '@': path.resolve(__dirname, 'src'),
13
+ },
14
+ configure: (webpackConfig) => {
15
+
16
+ // Disable hot reload completely if environment variable is set
17
+ if (config.disableHotReload) {
18
+ // Remove hot reload related plugins
19
+ webpackConfig.plugins = webpackConfig.plugins.filter(plugin => {
20
+ return !(plugin.constructor.name === 'HotModuleReplacementPlugin');
21
+ });
22
+
23
+ // Disable watch mode
24
+ webpackConfig.watch = false;
25
+ webpackConfig.watchOptions = {
26
+ ignored: /.*/, // Ignore all files
27
+ };
28
+ } else {
29
+ // Add ignored patterns to reduce watched directories
30
+ webpackConfig.watchOptions = {
31
+ ...webpackConfig.watchOptions,
32
+ ignored: [
33
+ '**/node_modules/**',
34
+ '**/.git/**',
35
+ '**/build/**',
36
+ '**/dist/**',
37
+ '**/coverage/**',
38
+ '**/public/**',
39
+ ],
40
+ };
41
+ }
42
+
43
+ return webpackConfig;
44
+ },
45
+ },
46
+ };