How to test local builds of JS projects located outside the src
folder in React projects
Table of contents⌗
Introduction⌗
create-react-app
is a tool that is used to generate a react project. When you are building tools in different repositories, you might want to use the build files from one external repo into your react application. However, create-react-app
blocks referencing external files in a react project.
This import will not work.
If you have a project structure like this:
How to fix⌗
You need to use the react package.json
file to fix this. Update the dependencies
of the file to this:
Then in the react project file that you are working in, import the dependencies as usual:
Conclusion⌗
This is an easy fix. There are other fixes which involve having new dependencies. You can explore them if this is not working for you.
Read other posts