-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for new ENTRY_PATH and PUBLIC_PATH advanced configuration variables #11729
base: main
Are you sure you want to change the base?
Conversation
Hi @dblazeski96! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Not sure I completely follow - when talking about micro front-ends we do have module federation on our radar #11241 |
Thanks @raix for getting back to me, I would be happy to provide more info, well I guess I should start at the problem domain: I need to come up with a solution to develop 3 separate client applications which are part of the same system, each app will control it's own business sub-domain (customer sub-domain, business sub-domain and admin sub-domain). Eventually I realized that for all 3 apps I'm looking at the same project, but with different business/domain logic. So I tried to do exactly that: create 1 container project where all shared assets will be located, and try to separate the business/domain logic of all 3 apps into their own separate locations within the container project. And came up with this solution, by combining Also one difference between module federation and this solution is that, as I understood it right (maybe not, but correct me if I'm wrong) module federation is sharing the components on runtime and would require all shared apps to be running for full shared experience, while this solution is actually building a self-contained apps (note only used shared assets are built, other are ignored) Using this solution would be helpful if the real difference between the apps is the business logic, while most of the assets are the same like components, configurations (rc, json, js, etc.), even some routes, etc. It gives a nice overview of all apps, but still keeps them separate. And it doesn't let you worry about maintaining another package just for shared assets. There is definitely a room for improvement, for example maybe a separate configuration could be added, or react-scripts could take these as arguments so |
We are trying to keep the number of configurations down to a minimum in CRA, it seems like this issue could be solved by:
Let me know if I misunderstood the problem |
No actually, you understood it just right. 😄 I wasn't very familiar with the npm/yarn workspaces concept, so I took a good look yesterday and made a few test projects. It seems to me that this is by far the best solution for my problem, so thank you for pointing out that to me. I see now that create-react-app is using the same concept, I taught it was just a folder structure decision. 🤣 Well this pull request was primarily opened for my multi-app issue, which is now resolved, I still think these two ENV variables can be useful in some cases, and they are optional. So I guess if you guys think these two are just bloat, I will close this pull request, else I will leave it open. |
Great! 🙂 - we might close it in spring cleaning, lets see |
Hello, Our app is inserted into a web page. For development we have a mock index.html and few files of vendor js & css to simulate the parent page on locale. For production there's a plain index.tml with just a single div as app's root, i.e. different set of files in public directory. In this scenario we are switching the public directory in file system before each start/build. So I hope you see how having an option to set PUBLIC_PATH would make it so much simpler. It seems that implementing this configuration option is a very small addition to the code. And ejecting to achieve it feels so wrong. |
This is exactly what i did when first time create react app |
Summary
Add support for a new environment variables,
ENTRY_PATH
andPUBLIC_PATH
, which may be used to override the default entry pointsrc/index
and the default public pathpublic
. It opens new possiblities for developing mini-apps within a container app without actually doingeject
, hence almost config-less micro-frontend architecure.Benefits
eject
for just a couple of paths (keeping thepackage.json
clean)If developing mini-apps are in mind
eject
Examples
Multiple build and start scripts for each mini-app
Github Workflow
Folder structure