lundi 14 mai 2018

minificated ember-concurrency timeout bug

there's an issue with timeout function in utils.js after production build with target set to last 1 chrome version only.

For demo open console and go to: https://cezaryh.github.io/ember-concurrency-utils-bug/

There's bug in ember-concurrency/utils module in timeout function. Code after minification looks like this:

e.timeout = function(e) {
  let t = new Ember.RSVP.Promise((t)=>{
    n = Ember.run.later(t, e)
  }), n;
  return t.__ec_cancel__ = ()=>{
    Ember.run.cancel(n)
  }
  ,t
}

The same code copied to other file (https://github.com/CezaryH/ember-concurrency-utils-bug/blob/master/app/utils.js) does not throw an error. And is minified differently

a.timeout = function(a) {
  let b, c = new Ember.RSVP.Promise((c)=>{
    b = Ember.run.later(c, a)
  });
  return c.__ec_cancel__ = ()=>{
    Ember.run.cancel(b)
  },c
}

In this case "b" is defined

that happens when build target is "last 1 Chrome versions"

config/targets.js

module.exports = {
  browsers: [
    'last 1 Chrome versions'
  ]
};

I can't figure out how to solve that, any ideas ?

that's also posted in ember-concurrency github https://github.com/machty/ember-concurrency/issues/232




Aucun commentaire:

Enregistrer un commentaire