mercredi 22 août 2018

Object.assign() in add-on in Ember app causes problems in IE11

I have an Ember app that uses several 3rd party add-ons. One of these add-ons uses Object.assign() which causes problem in IE11, specifically the error

Error: Object doesn't support property or method 'assign'

I know why this is happening, but I'm relatively new to Ember, and am not sure of the best way to handle/fix this. Based on my research, some options are:

Option 1: use polyfills (?)

I think there may be some additional libraries I can install, or options in Babel to set that will take care of this, but I have not been able to do so thus far. It's unclear whether any of these options would affect code from add-ons anyway, or if they only apply to code in the primary app.

Option 2: extend the add-on component to avoid Object.assign().

Unfortunately, the problematic lines are in the component's init(). When my extended component calls this._super(), the code I'm trying to avoid is run anyway. Is there a way to 'skip' the base component's init() and go straight to Ember's Component.init() (the add-on's _super()) ?

Option 3: ditch the 3rd party add-on, salvage what I can, and make my own component.

Irritating but do-able. At this point, it probably would have been faster to do that from the start.

I suspect that Option 1, polyfills and/or build settings, is the most correct course of action, but I'm at a loss for what, specifically, to do.

Additional info: My app was developed with Ember 2.7, and I am in the process of updating it to Ember 3.1. This issue exists in both builds.




Aucun commentaire:

Enregistrer un commentaire