I am using the package jagi:astronomy
, which is adding about 120kb to my client-side bundle. Because I wasn’t really using much of their client-side logic, I removed all references to it on the client side, and instead I send plain objects over the wire.
I was hoping that when I have an Astronomy package that is not referenced or imported, it would not be included in the client bundle. From the docs, I see that if a package is included with api.mainModule(..., 'client', { lazy: true})
, then it is not included in the client bundle if no importing code is found.
Well, jagi:astronomy
uses this format, but my code is still present in the bundle. I dove deeper into isobuild
than I would like to admit, and I see that the package is added not because it’s referenced by another package, but because it is referenced in .meteor/packages
and is thus an app constraint.
/* jagi:astronomy package.js */
api.mainModule("lib/main.js", ["client", "server"], { lazy: true });
Could someone tell me if I’m misunderstanding {lazy: true}
or if there’s something else I’m not doing correctly? I would love to create a bundle where jagi:astronomy
is available on the server, but not on the client.