How to properly setup symlinked library without ejecting?
See original GitHub issueI have 2 projects both created with create-react-app, both not ejected
one project, components-library is an app that only export components the other project, awesome-app is a single page app that makes use of components-library components
the scaffolding is like so:
components-library
|
---- src
| |
| ---- lib
| |
| |--- components
| | |
| | [...]
| | ---- Component.jsx
| ---- index.js //this import/export all the components
--- package.json
awesome-app
|
---- src
| |
| |---- index.js //this exposes the SPA
| ----- App.jsx //classic setup of react SPA
--- package.json
awesome-app is npm link
ed with npm link ../components-library
Is there a way to get the hotreaload to properly detects changes from awesome-app in the components-library/src/lib/**/*
folder?
I tried to setup chokidar
to observe the changes and launch a re-build script on the components-library but if chockidars rebuilds the components-library while awesome-app is running (with npm start
) awesome-app process get stuck and becomes unkillable (running from windows ubuntu subsystem bash, only way to kill the process is a complete computer reboot)
my issue looks somewhat related to this:
https://github.com/gaearon/react-hot-loader/issues/211
but i could not figure a solution yet…
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Importing uncompiled code from other packages in a monorepo is not currently supported by Create React App.
When you symlink, it actively watches changes & should update (reload) the code.
My guess is instead of doing
Do this
Go in
component-library
folder in terminal & typenpm link
and then go in your
awesome-app
folder in terminal & typenpm link NAME_OF_PACKAGE
Here
NAME_OF_PACKAGE
is thepackage.name
inpackage.json
file in yourcomponent-library
repo.Maybe this will help https://stackoverflow.com/a/20888757/4921319