Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove webpack configuration for externalising react #393

Merged

Conversation

bzf
Copy link
Contributor

@bzf bzf commented Apr 29, 2021

Since already we use the @apollo/client/core import, react won't be
included in the build.

Closes #389

Since already we use the `@apollo/client/core` import, `react` won't be
included in the build.

Closes ember-graphql#389
@bzf
Copy link
Contributor Author

bzf commented Apr 29, 2021

This fixes the issue we are experiencing at work, but I know very little about webpack and used @achambers suggestion in #389 to help move this forward. Hope that's ok 😊

@josemarluedke josemarluedke merged commit eb3efdc into ember-graphql:master Apr 30, 2021
@josemarluedke
Copy link
Member

Thank you @bzf. Published in v3.1.1.

@knownasilya
Copy link
Contributor

knownasilya commented May 6, 2021

I think this is still needed, because if a user imports anything from apollo, like error classes, they run into the error without this config. Maybe the solution is to codemod in the blueprint? And anyone using react can remove it.

@josemarluedke
Copy link
Member

josemarluedke commented May 6, 2021

@knownasilya there are two alternatives to avoid this issue:

    1. Add the configuration to externalize react in your app's ember-auto-import.
    1. Import everything from @apollo/client/core. If you import from the root, it will require React, but if you require it from the core, it will not.

@knownasilya
Copy link
Contributor

Seems like you'd have to do both honestly, since there is no great way to enforce where you import from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReferenceError: react is not defined
3 participants