reactjs - 为什么 Metro Bunler 加载我的应用程序需要这么长时间?

标签 reactjs react-native terminal bundling-and-minification

我的 React Native 应用程序需要 2 分钟才能加载,我想知道是什么原因造成的。当它达到 97.4% 时,它只会卡住大约两分钟,然后才达到 100%。我如何找出延迟的原因?

>npm start -- --reset-cache

> crew_rn@0.0.1 start /Users/######/crew_rn
> node node_modules/react-native/local-cli/cli.js start "--reset-cache"

Scanning folders for symlinks in /Users/######/crew_rn/node_modules (9ms)
┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│  Running Metro Bundler on port 8081.                                         │
│                                                                              │
│  Keep Metro running while developing on any JS projects. Feel free to        │
│  close this tab and run your own Metro instance if you prefer.               │
│                                                                              │
│  https://github.com/facebook/react-native                                    │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

Looking for JS files in
   /Users/#####/crew_rn 


Metro Bundler ready.

Loading dependency graph, done.
warning: the transform cache was reset.
 BUNDLE  [ios, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░ 97.4% (598/606)

最佳答案

我发现没有人回答我的问题,而且大家很感兴趣,所以我将分享我所做的事情。

在 package.json 文件中 - 有几个依赖项。我取出所有依赖项并慢慢将它们放回原处,直到我确定导致速度减慢的依赖项 - 然后我更改了其版本。这就是我采取的方法。

关于reactjs - 为什么 Metro Bunler 加载我的应用程序需要这么长时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48756872/

相关文章:

reactjs - React-Slick Carousel - 禁用箭头

reactjs - 如何在 map 函数中正确返回

react-native - react-native 中的倒数计时器

perl - 如何在 Perl 中测试包含 ANSI 颜色代码的字符串是否等效?

javascript - 使用 useInterval 钩子(Hook)取消异步请求

javascript - React 和 ES6 继承

react-native - react 原生的 Expo 应用程序的 WebP 格式

macos - 如何在不停止进程的情况下在使用 node.js 执行文件时关闭终端窗口?

terminal - Kotlin-native 执行命令并获取输出

node.js - 无法通过 Koa 和 koa-body HTTPS POST 1.5 mb 的 json 对象。仅状态 413 生产