Skip to content

Commit cbb5f25

Browse files
committed
Add webpack chunk splitting to prevent ngrok transmission issues
- Configure webpack to split chunks with 1MB max size limit - Separate vendor chunks from node_modules for better caching - Create common chunks for code shared across modules - Prevents large JavaScript files that cause truncation through ngrok - Improves reliability of asset delivery through tunnels - Resolves 'Unexpected end of input' JavaScript errors
1 parent 1b9f73d commit cbb5f25

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

craco.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,28 @@ module.exports = {
1616
include: /node_modules/,
1717
type: 'javascript/auto',
1818
});
19+
20+
// Split chunks to avoid large files that cause ngrok issues
21+
webpackConfig.optimization = {
22+
...webpackConfig.optimization,
23+
splitChunks: {
24+
chunks: 'all',
25+
cacheGroups: {
26+
vendor: {
27+
test: /[\\/]node_modules[\\/]/,
28+
name: 'vendors',
29+
chunks: 'all',
30+
maxSize: 1024 * 1024, // 1MB max chunk size
31+
},
32+
common: {
33+
minChunks: 2,
34+
chunks: 'all',
35+
maxSize: 1024 * 1024, // 1MB max chunk size
36+
},
37+
},
38+
},
39+
};
40+
1941
return webpackConfig;
2042
},
2143
plugins: [

0 commit comments

Comments
 (0)