mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-03 18:22:57 +00:00
hot fix #1
This commit is contained in:
@@ -6,6 +6,13 @@ module.exports = {
|
||||
'@': path.resolve(__dirname, 'src/')
|
||||
},
|
||||
configure: (webpackConfig) => {
|
||||
// Always remove ESLint for better performance
|
||||
webpackConfig.plugins = (webpackConfig.plugins || []).filter((plugin) => {
|
||||
const name = plugin && plugin.constructor && plugin.constructor.name;
|
||||
if (name === 'ESLintWebpackPlugin') return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
// Optimize for production builds
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
// Reduce memory usage during build
|
||||
@@ -30,6 +37,25 @@ module.exports = {
|
||||
runtimeChunk: 'single',
|
||||
};
|
||||
|
||||
// Limit parallelism of existing minimizers to lower memory footprint
|
||||
if (Array.isArray(webpackConfig.optimization.minimizer)) {
|
||||
webpackConfig.optimization.minimizer = webpackConfig.optimization.minimizer.map((minimizer) => {
|
||||
const name = minimizer && minimizer.constructor && minimizer.constructor.name;
|
||||
if (name === 'TerserPlugin') {
|
||||
if (minimizer.options) {
|
||||
minimizer.options.parallel = false;
|
||||
minimizer.options.extractComments = false;
|
||||
}
|
||||
}
|
||||
if (name === 'CssMinimizerPlugin' || name === 'CssMinimizerWebpackPlugin') {
|
||||
if (minimizer.options) {
|
||||
minimizer.options.parallel = 1;
|
||||
}
|
||||
}
|
||||
return minimizer;
|
||||
});
|
||||
}
|
||||
|
||||
// Disable source maps if env variable is set
|
||||
if (process.env.GENERATE_SOURCEMAP === 'false') {
|
||||
webpackConfig.devtool = false;
|
||||
|
||||
Reference in New Issue
Block a user