The setup:
./company/MyApp ./company/MyLibraryThe desired workflow would be:
- Working on
MyAppusing e.g. VSCode - Having
MyLibraryas dependency toMyApp - Make a change to
MyLibrarywithout having to recompile - Make a change to
MyLibrarywithout needing any services that detect this change MyAppbundles correctly usingMetro- Making changes to
MyLibrarywhilst the app is running will hot reload the app
What I have tried so far:
Using yarn link or npm link:
- cannot confirm that symlinked dependency is referenced from within the project by looking at the
node_modulesdirectory - read that
Metrobundler doesn't recognise symlinks (unconfirmed) - stopped trying at this point, but can imagine that the dependency would still need to be compiled before changes are available to
MyApp
Using WML
Works, but is cumbersome.Installation:
- Install watchman
- Install wml globally using
yarn global add wml - Run
watchman watch /Users/[your username]/.config/yarn/global/node_modules/wml/src(or whereverwmlis installed - Run
wml add ~/my-package ~/main-project/node_modules/my-package - Run
wml start
Workflow:
- Run
cd company/MyApp - Run
wml start - Run
yarn android:run(or whatever your platform and script name is) - Make changes to
MyLib - Run
(cd ../MyLibrary && tsc) - The app hot reloads with the latest changes from
MyLib
However, this workflow doesn't fulfil several desired requirements:
- Make a change to
MyLibrarywithout having to recompile - Make a change to
MyLibrarywithout needing any services that detect this change
Question:
How can you make changes to a local library from within your main project without having to compile the former or run any services that detect this change?