I have followed the instruction for this tutorial on testing react with Playwright. Whenever I start the webapp, I get the following error:
ERROR in ./src/modules/WeatherInfoComponent.js 1:40-148
Module not found: Error: You attempted to import /Users/alexsombaty/Development/react-component-testing-demo/node_modules/react-refresh/runtime.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
You can either move it inside src/, or add a symlink to it from project’s node_modules/.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
I think that this error usually happens when Create React App blocks imports outside of the src/
folder. react-refresh/runtime.js
should already come from node_modules
, so something may be misconfigured.
I would suggest making sure you didn’t accidentally import react-refresh
directly in your code. It’s handled by the dev server automatically. And also try to delete node_modules
and package-lock.json
(or yarn.lock
) and reinstall with npm install
or yarn install
.
This usually clears up with a clean reinstall. By the way, which tutorial exactly are you following?
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.