We have a mono-laravel-repo and are in the process of migrating to a cleaner, easier to maintain dev reboot.
We have recently moved towards migrating our existing PHP based views into multiple React-based "features" that live in a /react
directory and are organised into /react/featureName
sub-directories. This means Laravel's controllers mostly handle data and authentication only.
Each feature is maintained by one or more developers, have their own dependencies, tests and functionality.
We're currently serving builds in the public root of our project organised by feature:
js/FeatureName.hashed.js
css/FeatureName.hased.css
which works great except that we share many packages between features
. React itself, react-router etc.
We intend to use Laravel's mix.js
as much as possible, but hacking directly on webpack.config
is also an option.
I've explored the mix.extract()
option that allows us to define vendor.js builds separate from other application logic but it stops there.
So here are my question(s)
- What approaches are there to manage multiple
package.json
files that live in each feature directory - How do we identify common packages and lock them into a root
/package.json
file. (Independently, all developers already useyarn
) - How to accomplish this with as little friction as possible for all react based developers - so that they get to simply continue with whatever they are already doing and DevOps handles the gritty bits?
I understand there might be a need for more information, please shout out what you need in the comments and I'd be happy to update the question.