Disable hot-code-push package on production

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.

1 Like

There may be better ways, but you could fork the package and set the debugOnly flag to true in the object you give to Package.describe.

1 Like

Not a bad idea, and simple enough to implement. Thank you!

Update: that idea falls flat because I’ve got two other packages including the “reload” package:

  • accounts-base
  • ddp

So I’d be going down a big rabbit hole trying to disable those as well. Probably best to just keep it the way it is for now :frowning:

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!

1 Like

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?