Files
MyClub/frontend/craco.config.js
T
Tomas Dvorak 63700eedb2 dev day #67
2025-10-21 15:02:05 +02:00

43 lines
1.1 KiB
JavaScript

const path = require('path');
module.exports = {
webpack: {
alias: {
'@': path.resolve(__dirname, 'src/')
},
configure: (webpackConfig) => {
// Optimize for production builds
if (process.env.NODE_ENV === 'production') {
// Reduce memory usage during build
webpackConfig.optimization = {
...webpackConfig.optimization,
splitChunks: {
chunks: 'all',
cacheGroups: {
defaultVendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10,
reuseExistingChunk: true,
},
default: {
minChunks: 2,
priority: -20,
reuseExistingChunk: true,
},
},
},
// Use single runtime chunk
runtimeChunk: 'single',
};
// Disable source maps if env variable is set
if (process.env.GENERATE_SOURCEMAP === 'false') {
webpackConfig.devtool = false;
}
}
return webpackConfig;
},
}
};