我的 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/