ember-fetch: fetch is not defined - maybe your browser targets are not covering everything you need

I believe I have tracked the issue down to https://github.com/github/fetch. In version 3.1.1 it used to contain this https://github.com/github/fetch/blob/v3.1.1/fetch.js#L546 but in 3.2.0 it now contains this https://github.com/github/fetch/blob/v3.2.0/fetch.js#L564

Ember-fetch contains this check https://github.com/ember-cli/ember-fetch/blob/master/assets/browser-fetch.js.t#L36. I believe the module body here https://github.com/ember-cli/ember-fetch/blob/master/assets/browser-fetch.js.t#L34 injects the fetch library somehow. Ember-fetch is checking self and I think it now needs to check global maybe. Since this happened so long ago I dont know what dependencies have changed to make it fail for me now, but it failed today for me in multiple unrelated projects.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 31 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Hey, turns out I was using ember-simple-auth version 2.1.0, which uses an older version of ember-fetch . I was able to fix the issue by upgrading ember-simple-auth

All of my addons have started failing with Error: fetch is not defined - maybe your browser targets are not covering everything you need?. What’s the workaround?

I’m using ember-fetch 8.0.4 and still have this issue.

This addon docs PR is currently throwing the error https://github.com/ember-learn/ember-cli-addon-docs/pull/495

If your using yarn add this to your package.json

"resolutions": {
  "whatwg-fetch": "3.3.1"
 }

Looks like new release 3.4.0 of whatwg-fetch breaks ember-fetch