react中配置性能分析插件,便于直观了解各个依赖包大小 

 .umirc.ts中

export default defineConfig({
    ....
    analyze: {
        analyzerMode: 'server',
        analyzerPort: 8888,
        openAnalyzer: true,
        generateStatsFile: false,
        statsFilename: 'stats.json',
        logLevel: 'info',
        defaultSizes: 'parsed',
    }
});

package.json中

{
  "private": true,
  "scripts": {
    "analyze": "cross-env ANALYZE=1 umi build"
  },
  "gitHooks": {
    "pre-commit": "lint-staged"
  },
  "lint-staged": {
    "*.{js,jsx,less,md,json}": [
      "prettier --write"
    ],
    "*.ts?(x)": [
      "prettier --parser=typescript --write"
    ]
  },
  "dependencies": {
   
  },
  "devDependencies": {
    "umi-webpack-bundle-analyzer": "^4.4.2"
  }
}

 运行  yarn  analyze 即可在本地启动http://127.0.0.1:8888/