Replies: 5 comments 12 replies
-
@Buuntu the https://create-react-app.dev/docs/importing-a-component/#absolute-imports |
Beta Was this translation helpful? Give feedback.
-
That's for importing libraries in code, it still doesn't solve most of the common issues (linked above) around Docker workflows and node_modules though. |
Beta Was this translation helpful? Give feedback.
-
I'd say that node_modules is the issue only in OS X, due to the well known performance issue with osxfs.
Usage:
|
Beta Was this translation helpful? Give feedback.
-
@Vanuan Can you be more specific? How do you run Even if that works, I'd like to install dependencies at build time so I can take advantage of docker's caching. |
Beta Was this translation helpful? Give feedback.
-
FWIW I already have a working config that does this.
To get this running, you just have to run This works but has the following issues:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It would be good to have a recommended workflow using Docker, for example when working on a full stack application (both frontend and backend). I know Docker is outside of the scope of create-react-app but feel like this is a pretty common workflow, and judging by the popularity of some Stackoverflow threads I think this is common enough that it might warrant a discussion:
https://stackoverflow.com/questions/30043872/docker-compose-node-modules-not-present-in-a-volume-after-npm-install-succeeds
https://stackoverflow.com/questions/38425996/docker-compose-volume-on-node-modules-but-is-empty
https://stackoverflow.com/questions/38758361/create-react-app-with-docker
None of these threads have very clean solutions, since they often significantly increase start/build times or have edge cases when building from scratch and/or updating packages.
I myself am having issue setting this up with docker-compose and hot reloading without jumping through a lot of hoops . Many of the issues stem around node_modules and the fact that create-react-app expects these in src and doesn't allow you to use absolute paths for NODE_PATH to keep node_modules outside of your mounted volume. Basically this old issue: #4928
It would be great if there was a short section in documentation or a README describing how to do this, or if it's too complicated, maybe describing why you shouldn't develop in Docker at all.
Beta Was this translation helpful? Give feedback.
All reactions