[solved] Upgrade to 1.5 breaks app on mobile browser: "can't redefine _esModule"

Is anyone else seeing this? Can anyone suggest a strategy for finding out the root cause of it?

My app is bombing on mobile browsers, despite passing all tests on desktop browsers.

I tracked down the problem, as well as I could, to the upgrade of ecmascript@0.7.3 to ecmascript@0.8.0, in fact, the problem also appears if I stay at Meteor version and make only that change.

Using ´chrome:inspect´, I see the error message : "Uncaught TypeError: Cannot redefine property: __esModule ";

The error occurs somewhere in all the nested require steps before anything is actually displayed. It seems to originate in the file node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js from the line utils.setESModule(this.exports); of the function :

// Register getter functions for local variables in the scope of an export                                             // 54
// statement. Pass true as the second argument to indicate that the getter                                             // 55
// functions always return the same values.                                                                            // 56
function moduleExport(getters, constant) {                                                                             // 57
  utils.setESModule(this.exports);                                                                                     // 58
  var entry = Entry.getOrCreate(this.exports, this);                                                                   // 59
  entry.addGetters(getters, constant);                                                                                 // 60
  if (this.loaded) {                                                                                                   // 61
    // If the module has already been evaluated, then we need to trigger                                               // 62
    // another round of entry.runSetters calls, which begins by calling                                                // 63
    // entry.runModuleGetters(module).                                                                                 // 64
    entry.runSetters();                                                                                                // 65
  }                                                                                                                    // 66
}                                                                                                                      // 67
                                                                                                                   // 68

where the module being loaded is simply :

const Queries = `
    author(_id: Int, firstName: String, lastName: String): [Author]

const Mutations = `
      firstName: String
      lastName: String!
    ): Author

const Types = `
  type Author {
    _id: Int
    firstName: String
    lastName: String
    books: [Book]
    deleted: Boolean
    deletedAt: Int

export const schema = {
  qry: Queries,
  mut: Mutations,
  typ: Types

Maybe check out this issue – looks like @ffxsam had the same ecmascript upgrade in his bad commit.

1 Like

@vigorwebsolutions That looks like a fruitful direction to investigate, for sure.

Thanx. I’ll post my findings.

1 Like

So I just posted an Issue about it.

@benjamn published the fix 4 hours later!! :astonished:

1 Like