Closed CaptainN closed 4 years ago
I guess this would be worth it, though I don't know why Meteor does it this way. It would be better if each project could just choose to depend on it lazily without requiring a breaking change to the package like this.
I agree. Meteor needs more of a peer dependency definition. This is probably a breaking change though - it would require some use cases do an intentional import. Maybe that's too much? IDK.
I am transferring this to @Meteor-Community-Packages so I will let others help decide whether this is worth a major version release.
I'm in agreement for major version update with this. Preferably with other changes updates like #250 so that there is a bit more goodies in the update.
Thank you @StorytellerCZ. I was kinda skeptical whether to do a major or minor update, as for including #250 it seems that needs more work so I'm unsure about it.
@harryadelb Yes, but that is out of scope for this PR. It is just matter of including things and timing the release. Anyhow @CaptainN could you please update your PR to fix the conflicts and do a major version bump. Thanks!
I actually think this would be too difficult for most users. We should probably not merge this.
@CaptainN why would this be difficult?
Users could have to intentionally import the package before creating their collections. It would not auto attach to the collections the way it does now.
What about either exporting Collection after it's modified so that it makes sense as to why you are importing something, or a combination of that and making use of the technique outlined by this article by @jankapunkt: https://dev.to/jankapunkt/lightweight-meteor-packages-with-conditional-dynamic-imports-1d51 so that it's optional?
I like the idea of exporting the modified collection (collection2) instead of modifying the original the way it does now. That's a better pattern in general, IMHO. It would allow for better code splitting and all that too.
But that's a HUGE change, and we'd need some wide discussion to catch any possible consequences that we aren't seeing. I generally support this idea though.
@CaptainN I'm all for it. Maybe start a topic on the forums?
Make module export lazy as per #394