I want to start a new app that will have both web and reactnative interfaces.
I decided to move all business -non enviroment dependent- code into a third package -aka sdk- that i can share between both react & react native .
So my project now has 4 modules
- Web -- created with cra
- Sdk -- mainly redux + redux saga + react containers + Hoc's
- Mobile -react native
Server - nodejs express api.
- All web, mobile and server will depend on Sdk module.
- sdk module will depend on server module -mainly to impory mocks and data interfaces.
Is there any standard way to achieve such structure ?
Most probably i would love to
- use yarn workspaces to hoist all node-modules into one folder to avoid reinstalling packages in every project
- i will be working in all 4 projects at same time, so i need hotreload to be aware of this.
** challenges im facing **
- Cra doesnot transpile code outside src folder so although web project does refresh qhen i make changes on sdk. It cannot understand es6 code.
- Jest also doesnot understand es6 from node_modules
How can i avoid rebuilding step while working on both sdk and web modules simultaneous ?
babel
config is just one example of many. Just eject it, or use some overriding tools (which is yet another hack over existing one).