-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Description
Currently for all platforms except web we are generating a single generated Dart plugin registrant file, with a bunch of Platform
checks in it to decide what to register. This means that the Dart side of every platform's implementation is shipped to every platform (due to #14233). Ideally the tree shaking itself should be fixed, but absent that we may want to optimize this at the generated registrant level by having a different registration file for each platform.
The complexity here is that we currently don't have all the implementation we need at the compilation step to know what to target; we're currently using file existence, which is somewhat fragile, and wouldn't scale here. We'd need to figure out if we could plumb things all the way through to make sure we are using the correct file in each compilation invocation (even in complex scenarios like hot reload or hot restart when running simultaneously on multiple devices).
It may never be worth doing this, since the Dart side of plugins is probably not all that much code in the grand scheme of things, but filing for tracking to consolidate any discussion about this.
/cc @gaaclarke