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
Fix react-refresh package exports #24235
Fix react-refresh package exports #24235
Conversation
Fixed an error that occurred when using CRA with typescript. Uninstalled the react-refresh package and reinstalled as well was deleting and rebuilding the `package-lock.json` file and the error still persisted. Adding an additional entry for the `exports` property in the `package.json` file fixed it.
Comparing: 4db3ff6...815ffec Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
Can you please provide a reproducing project? |
Can confirm this bug |
Also bump into such bug |
Hi, I have the same issue and can verify that the fix provided works for me. I have created the app using CRA. Steps to reproduce the error: Clear the Node modules |
I wasn't able to reproduce the error from a new react project. I'm not sure how the error originated as I didn't make any changes to my |
Please provide a reproducing project. Thank you. If you don’t have one, +1 comments are not necessary. They create noise for every person watching this repository. |
Would a clone of my project that can produce the error work? This is my first time making a contribution so I'm not sure if you want a newly created project that isn't modified. |
Yes, a clone would work! |
Here is a link to clone the repository: https://github.com/toomuchrice4u/whitelist.git I just made a clone and tested it and I think the cause was the update of the |
Thanks! I know what the commit was but what I’m confused about is why your project imports it with the extension. I will have a look at this later. |
I think |
OK, so the issue here is that you installed The problem with You can track that issue in pmmmwh/react-refresh-webpack-plugin#619. There are no changes needed in the React repo. |
I have verified that the instructions in #24235 (comment) do not reproduce the issue. Since |
Summary
Fixed an error that occurred when using CRA with typescript. Uninstalled
the react-refresh package and reinstalled as well as deleted and
rebuilt the
package-lock.json
file and the error still persisted.Adding an additional entry for the
exports
property in thepackage.json
file fixed it.Error log:
ERROR in ./src/index.tsx
Module build failed: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './runtime.js' is not defined by "exports" in Q:\whitelist\node_modules\react-refresh\package.json
at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:429:9)
at packageExportsResolve (node:internal/modules/esm/resolve:703:3)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at Object. (Q:\whitelist\node_modules@pmmmwh\react-refresh-webpack-plugin\loader\index.js:20:4)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
How did you test this change?
It doesn't directly affect any code in the package or in React in general since it just adds an additional glob path for the same file that is exported. I still ran the tests though, despite not making any real changes, and resulted in 273 suites passed, 2 skipped, and 7 failed.