-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
4.0.0-next.77 sample app yields "Module not found: Your application tried to access react-refresh" when started with Yarn 2 #9446
Comments
So if I understand correctly, react-refresh-webpack-plugin basically injects It seems like we can't fix it other than adding a note to the README.md asking people, who use Yarn 2, to also install |
So crazy story. Do |
@eddiemonge it works with npm and it works with Yarn 1.22.4 as well, because both of them use node_modules. Yarn 2 on the other hand keeps packages in .yarn/cache and complains if packages try to require modules they didn't list as their dependencies, because, even though it has |
Maintainer of the fast refresh plugin here.
Technically speaking, it is always unsound to import something that you haven't listed in your dependencies. Through hoisting it might work (for example in CRA v3
Yes, that is the case. We had to do that (kinda like how
To me I think the best resolution to this problem would be to list I can PR this change (or actually, anyone can do it) - but I'll wait for the maintainers' point of view on this before progressing. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
Bump - I think I'll proceed on making a PR to push further discussions. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
Bump - #9671 |
Hitting this error now. Does |
When I add Edit: Possible solution! run |
Oh yeah, same. |
@volodymyr-kushnir Or you know, enabling the
@eddiemonge That's not a solution and it's not an issue in Yarn 2's PnP mode, they are simply undeclared dependencies
@pmmmwh It would be better for the plugin to resolve the import before injecting it, that way it works no matter what, PR at pmmmwh/react-refresh-webpack-plugin#230 |
@merceyz Plug'n'Play is what I'm after, so node-modules linker is not an option, but adding missing dependencies might be. Followed your advise and did |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
bump
…On Fri, Dec 25, 2020, 10:10 stale[bot] ***@***.***> wrote:
This issue has been automatically marked as stale because it has not had
any recent activity. It will be closed in 5 days if no further activity
occurs.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#9446 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAABW4UWEMJBF6UCXR7SSMDSWTIS7ANCNFSM4PWYHZHQ>
.
|
I just setup create-react-app using Yarn 2 today and I got this error. What is the proposed resolution for this? |
Add it as a dependency until #9872 is merged |
Describe the bug
[email protected]
yields "Module not found: Your application tried to access react-refresh, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound." after runningyarn start
with Yarn 2. Installingreact-refresh
as dependency solves the problem, tho.Environment
Steps to reproduce
npx create-react-app@next --scripts-version=@next --template=cra-template@next my-js-app
cd my-js-app
yarn set version berry
yarn set version latest
yarn install
yarn start
Expected behavior
App is served without problems.
Actual behavior
App throws an error.
The text was updated successfully, but these errors were encountered: