Skip to content

fix: add react-refresh as a dependency for templates - #9671

Closed
pmmmwh wants to merge 2 commits into
react:masterfrom
pmmmwh:fix/react-refresh-peer-dep
Closed

fix: add react-refresh as a dependency for templates#9671
pmmmwh wants to merge 2 commits into
react:masterfrom
pmmmwh:fix/react-refresh-peer-dep

Conversation

@pmmmwh

Copy link
Copy Markdown
Contributor

This fixes#9446 - basically I've added react-refresh to the starting templates so that the peerDependency from react-refresh-webpack-plugin would properly resolve in stricter module systems (e.g. Yarn 2 and PnP). It is already a dependency of react-scripts but that does not suffice because imports to react-refresh/runtime will be injected to the users' bundle.

@mrmckeb

Copy link
Copy Markdown
Contributor

Thanks for this @pmmmwh!

We also have community templates, it might be better to add it here?
https://github.com/facebook/create-react-app/blob/master/packages/create-react-app/createReactApp.js#L434

Maybe @iansu and/or @ianschmitz have some thoughts too.

@pmmmwh

Copy link
Copy Markdown
ContributorAuthor

I've update the PR to install react-refresh within the CRA command instead - I've made the changes where I think is necessary, but please feel free to correct me cause I'm not very familiar with the CLI's structure!

@merceyz

Copy link
Copy Markdown
Contributor

This should be fixed in the plugin instead by having it resolve it before injecting the import - pmmmwh/react-refresh-webpack-plugin#230

@pmmmwh

Copy link
Copy Markdown
ContributorAuthor

This should be fixed in the plugin instead by having it resolve it before injecting the import - pmmmwh/react-refresh-webpack-plugin#230

Do you think that this is still needed after the fix in the plugin?

@merceyz

merceyz commented Nov 8, 2020

Copy link
Copy Markdown
Contributor

Do you think that this is still needed after the fix in the plugin?

Nope, it's not needed anymore. The plugin is updated in #9872 together with other dependency fixes

@pmmmwh

Copy link
Copy Markdown
ContributorAuthor

Superseded by #9872

@pmmmwhpmmmwh closed this Nov 11, 2020
@pmmmwh
pmmmwh deleted the fix/react-refresh-peer-dep branch November 11, 2020 20:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4.0.0-next.77 sample app yields "Module not found: Your application tried to access react-refresh" when started with Yarn 2

6 participants

@pmmmwh@mrmckeb@merceyz@iansu@ianschmitz@facebook-github-bot