The question:
How do I load a package in development but not production?
The context:
The package hot-code-push is included as part of meteor-base, and is very useful in the development environment (it automatically reloads your page when it detects changes).
On my production app, I have this automatic reload disabled using the following code:
if (Meteor.isProduction) {
Reload._onMigrate(function() {
return [false]
})
}
The above works, however the package is still included as part of the Meteor bundle, and one of my top subscriptions is for meteor_autoupdate_clientVersions per screenshot below:
My understanding is that this subscription is directly linked to the hot-code-push package, and that if I remove it on production, it will disappear.
The question again:
To re-iterate the question: how do I selectively load a package in development, but not in production? Not sure it’s possible from my .meteor/packages file.
You could use the --extra-packages command line argument, as used by the bundle visualizer, but you’d have to remember to use it each time you’re running in development mode.
Okay I think I got this! Following @softwarerero’s advice, I also created a custom version of the autoupdate package and set debugOnly:true. Just rolled everything out to production, and it looks like folks are no longer being subscribed to meteor_autoupdate_clientVersions. Success!
Sorry to revive an old thread but I’m noticing that meteor_autoupdate_clientVersions and meteor.loginServiceConfiguration are subscribed to a lot in production and I’m wondering if there is now a simpler way of removing packages like autoupdate in production only than this method?