-
Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
tido64
Jan 17, 2024
Replies: 2 comments 5 replies
-
have you checked out https://microsoft.github.io/rnx-kit/docs/guides/bundling and https://microsoft.github.io/rnx-kit/docs/tools/metro-serializer-esbuild ? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes, esbuild suppports treeshaking, however I'm interested in how the treeshaking flag in rnx bundler config works when it's using Metro. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Metro flow goes something like this:
Our plugins are run inside the "Serialize" step. By this step, Metro is done transforming all source code and is ready to write to disk. We take all the transformed code and pass it to esbuild for yet another pass. The output of this pass is then written to disk.
As you can probably see, it is a bit hacky. I wish there was a better way to implement tree shaking in Metro right now, but it's going to take a while to do it correctly. That said, we are using it in a number of products, including Office apps if I remember correctly.