ember-graphql / ember-apollo-client

🚀 An ember-cli addon for Apollo Client and GraphQL
MIT License
279 stars 72 forks source link

Allow using `ember-apollo-client` without `ember-fetch` #429

Closed bertdeblock closed 10 months ago

josemarluedke commented 1 year ago

@bertdeblock Changes look good so far, however, tests for embroider-optimized are failing, can you take a look at that?

bertdeblock commented 1 year ago

Yeah, the issue is with return importSync('fetch').default.default;. The double default isn't right / a bug I think, but seems to be the only way to get the equivalent of import fetch from 'fetch'; in a classic build, but this fails under Embroider. A similar issue was created here: https://github.com/embroider-build/embroider/issues/1203.

Possible workaround:

if (macroCondition(dependencySatisfies('ember-fetch', '^8.0.0'))) {
  const emberFetch = importSync('fetch');

  return emberFetch.default.default || emberFetch.default;
}

but doesn't really feel right 😄.