jagi / meteor-astronomy

Model layer for Meteor
https://atmospherejs.com/jagi/astronomy
MIT License
604 stars 67 forks source link

Dynamic import of Astronomy #683

Closed jramer closed 6 years ago

jramer commented 6 years ago

First I'd like to say that Astronomy is great! Thanks for the hard work.

I'm trying to get Astronomy loaded dynamically. Read the closed issue #642 and thought it would be possible.

Even a new meteor project loads astronomy to the client.

My test:

meteor create testAst
cd testAst
meteor add jagi:astronomy
meteor --extra-packages bundle-visualizer --production
lukejagodzinski commented 6 years ago

Hmm in deed it bundles it no matter what. I've made some tests and even with the new package it still bundles it, so probably there is no way I can leave Meteor packages out of bundle. It's probably only reserved for the NPM packages. However, if you know about any Atmosphere package that doesn't get bundled, then please let me know.

arggh commented 6 years ago

If I remember correctly, you could just have a bunch of js files inside the Meteor package, which can be imported by the app code. If they're not imported explicitly, they don't get bundled.

At least that's how I'm dynamically importing Blaze templates from a package when needed.

The crucial part is to not have the files referenced in package.js in any of the entry points.

lukejagodzinski commented 6 years ago

Ok I found out that apparently you have to add {lazy: true} to your main module export. I will fix that on Monday

On Sat, Sep 15, 2018, 8:21 PM arggh notifications@github.com wrote:

If I remember correctly, you could just have a bunch of js files inside the Meteor package, which can be imported by the app code. If they're not imported explicitly, they don't get bundled.

At least that's how I'm dynamically importing Blaze templates from a package when needed.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jagi/meteor-astronomy/issues/683#issuecomment-421611267, or mute the thread https://github.com/notifications/unsubscribe-auth/ABAKXQ9cRq1X0iNr7DWs9KvFhOE5CttVks5ubUUagaJpZM4WEKVG .

arggh commented 6 years ago

Oh good! Somehow I had completely missed that one.

lukejagodzinski commented 6 years ago

Fixed in 2.6.0

jramer commented 6 years ago

Oh! This is great! Thank you for taking the time! Sorry I missed the conversation. (Apparently I had disabled all github notifications...)