metro-serializer-esbuild causing slower app TTI (TTFD) #2766
Replies: 1 comment 24 replies
-
Hi @BrentonWheeler, I think the difference you're seeing is due to If I understand it correctly, const fs = require("fs");
function read(p) {
return fs.readFile("package.json", "utf-8");
} Becomes: function read(p) {
return require("fs").readFile("package.json", "utf-8");
} This can have a positive impact on your TTI because parts of your bundle is not executed until it is needed. However, we've disabled this in our apps because it assumes none of your dependencies have any side effects. We've experienced crashes because of this flag, so we always disable it now. This is also why we haven't seen this perf difference. That said, the reason |
Beta Was this translation helpful? Give feedback.
-
I'm finding that when using
metro-serializer-esbuild
instead of justmetro-serializer
that, while my app JS bundle is reduced by 40% (awesome BTW), my app launch time has gone from ~5s to ~9s (on a slow device) and a similar almost doubling of launch time on faster devices (only tested Android so far). Tested via the "Fully drawn"logcat
log value (which can be added via use of https://www.npmjs.com/package/react-native-startup-time)Let me know if you see this too otherwise I can look into making a reproduction example.EDIT: Reproduction example: https://github.com/BrentonWheeler/esbuild-tti-test-app
yarn bundle:install
(usingmetro-serializer
):yarn bundle:install+esbuild
(usingmetro-serializer-esbuild
):Beta Was this translation helpful? Give feedback.
All reactions