Skip to content

Transpiled client code fails to eval on the server #8

@artemave

Description

@artemave

This innocent looking code

    return server.run(commissions, function(commissions) {
      const commissionWriter = serverRequire('./test/support/commissionWriter')(this.tropicsDb);
      return commissionWriter.addNew(...commissions);
    })

Fails with a seemingly unrelated error message:

      ReferenceError: _toConsumableArray is not defined
          at Object.eval (eval at run (/Users/artem/projects/booking-services/node_modules/karma-server-side/index.js:61:12), <anonymous>:5:62)

The problem is that by the time this code is sent to the server side for evaluation it has been transpiled into this:

      var commissionWriter = serverRequire('./test/support/commissionWriter')(this.tropicsDb);
      return commissionWriter.addNew.apply(commissionWriter, _toConsumableArray(commissions));

Which then fails to eval since there is no such thing as _toConsumableArray defined on the server (it supports ... natively)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions