Meteor 1.6.1.1 client app fails with Package.modules undefined using --production


#1

Hi,

I am upgrading Meteor from version 1.5.1 to 1.6.1.1. Had faced few issues while upgrading as below:

  • ssrwpo:uglifyjs2 babel constraint. This was fixed by locally overriding the package & updating the babel constraint to 7.0.7. Referred this.
  • Babel compiler issue was fixed by following babel upgrade steps as mentioned here.
  • WebAppInternals.getBoilerplate was returning stream instead of string as before. So html-minifier stopped working as it expected string. So fixed it by converting stream to string & promise as it became async.

After this the app was working properly locally using the command:

meteor --settings settings-default.json

But when deployed my code to Heroku, the client side app fails with errors specifying that lot of modules like meteor-base, babel-runtime, ecmascript-runtime etc were not loaded. Browser console shows this error (an example of babel-runtime error):

Uncaught TypeError: Cannot read property 'meteorInstall' of undefined
    at babel-runtime.js?hash=ad2513735fa8d9d75196ab30ea0bd927586919be:17
    at babel-runtime.js?hash=ad2513735fa8d9d75196ab30ea0bd927586919be:149
(anonymous) @ babel-runtime.js?hash=ad2513735fa8d9d75196ab30ea0bd927586919be:17
(anonymous) @ babel-runtime.js?hash=ad2513735fa8d9d75196ab30ea0bd927586919be:149
18:46:49.600 

When I checked line 17 of babel-runtime it shows below code of which modules is undefined which is why it fails:

var meteorInstall = Package.modules.meteorInstall;

On Heroku, we are using meteor-buildpack-horse to build our app. When I checked the commands that it uses I saw its using --production flag while running as shown here.

So I tried the same on local using command & got the same issues on local:

meteor --settings settings-default.json --production

Can someone please help or point out what could be happening here with --production flag?

Thanks,
Nilesh


#2

The --production flag just consolidates and minifies. It’s still a dev environment:


#3

Thank you @robfallows. I read this & seems this should not cause the issue I am facing as its just minifying whatever data we give it to.

The next thought I have is npm install command that build pack is using also has --production flag that is related to npm install command which installs all dependencies & no devDependencies.

Could this be somehow related?


#4

Perhaps: if you have some dependencies defined in your package.json as dev, when they should be prod.