mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-03 18:22:57 +00:00
43 lines
1.1 KiB
JavaScript
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;
|
|
},
|
|
}
|
|
};
|