machty / ember-concurrency

ember-concurrency is an Ember Addon that enables you to write concise, worry-free, cancelable, restartable, asynchronous tasks.
http://ember-concurrency.com
MIT License
690 stars 157 forks source link

Breaks if regenerator-runtime is not required by Babel targets #345

Closed raido closed 4 years ago

raido commented 4 years ago

Application will crash if ember-maybe-import-regenerator has determined based on config/targets.js browsers that regenerator runtime is not required but somehow -cancelable-promise-helpers still depends on regenerator.

Workaround for now

https://www.npmjs.com/package/regenerator-runtime

yarn add/npm i regenerator-runtime

// ember-cli-build.js

if (isProduction) { // If your production targets are different from development ones
   app.import(require('regenerator-runtime/path').path, { prepend: true });
}
Screenshot 2020-02-11 at 20 01 02
maxfierke commented 4 years ago

I think this is likely an issue with the babel or ember-cli-babel setup in your app (or potentially ember-maybe-import-regenerator), as we don't use or enforce regenerator runtime directly within ember-concurrency.

For example, you may need to add exclude: ['@babel/plugin-transform-regenerator']; to your ember-cli-babel babel config.

raido commented 4 years ago

It seems so actually, I found out which of the browserlist queries caused it. I have explicit query for not Safari < 10 - and that blows it up.

This query also blows up ember-cli-test-loader and few other things. But yes, ember-concurrency here is not the reason.