adopted-ember-addons / ember-cli-flash

Simple, highly configurable flash messages for ember-cli
https://www.npmjs.com/package/ember-cli-flash
MIT License
355 stars 113 forks source link

Throws when used with ember-cli-babel `includeExternalHelpers: true` #341

Closed makepanic closed 3 years ago

makepanic commented 3 years ago

Hi,

when using ember-cli-flash in a project that enables includeExternalHelpers in its ember-cli-babel settings, the transpiled code will throw.

This happens because the addon/flash/object defines a Object class. During the transpilation babel adds the esModule marker:

Object.defineProperty(_exports, "__esModule", {
    value: true
});

// ...

var Object = (_dec = (0, _computed.guidFor)('message').readOnly(), (_class = (_temp = /*#__PURE__*/function (_Ember$Object$extend) {

Due to variable hoisting, it'll try to call defineProperty on the class that ember-cli-flash defined.

If it's ok, I'll open a PR to rename that class name to something like FlashObject which prevents this from happening.