问题:开启 sentry 配置,导致构建内存泄漏

默认构建配置
使用1个Worker,内存限制为2048MB
处理方式:
// Modifying node memory limitsexport NODE_OPTIONS="--max-old-space-size=8192"// 或者修改 SourceMap 生成方式(最低成本)// https://v3.umijs.org/zh-CN/guide/boost-compile-speed#调整-sourcemap-生成方式const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');module.exports = {configureWebpack: config => {// get a reference to the existing ForkTsCheckerWebpackPluginconst existingForkTsChecker = config.plugins.filter(p => p instanceof ForkTsCheckerWebpackPlugin)[0];// remove the existing ForkTsCheckerWebpackPlugin// so that we can replace it with our modified versionconfig.plugins = config.plugins.filter(p => !(p instanceof ForkTsCheckerWebpackPlugin));// copy the options from the original ForkTsCheckerWebpackPlugin// instance and add the memoryLimit propertyconst forkTsCheckerOptions = existingForkTsChecker.options;// modification the workersforkTsCheckerOptions.workers = 2;// modification the memoryLimitforkTsCheckerOptions.memoryLimit = 12288;config.plugins.push(new ForkTsCheckerWebpackPlugin(forkTsCheckerOptions));}};
修改后居然提升了构建速度
Before
Now
