-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Allow add multiple entry points 1084 #8249
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
3ad38b5
to
306533f
Compare
@DanZeuss I would mark this PR as a still Work In Progress (WIP). There are more things to check, that will work with this
|
@iamandrewluca You could run I'm even using a project created from this fork using |
@iamandrewluca and @DanZeuss Who is assigned to test and verify these things work? |
@bretep Right now nobody is assigned. @DanZeuss should do some tests to check if everything is fine. Well at least current tests should pass 🙂 I'll find some time to do some tests this week with this new feature in progress. |
Hey Bret. I'm not sure how the testing process works on this project. We could be working together in order to get it done. |
There's just one missing feature to be tested. I'm going to test if the PWA is working fine on my mobile. |
I think that having
|
You make a fair point. I personally use the HTML file and point my proxy to it as not to interfere with routes. Because this is static content, I think it is reasonable to have .html file vs. separate paths. If a user wants multiple entry points to work, they’re probably already using a reverse proxy. My static content live in google cloud storage and I point my proxy directly at the index.html file and my multiple entry point index files. I had to do this regardless of multiple entry else routes would not work. |
Also, I think having separate paths is going to:
Keep it simple with another .html file and the SPA will work as expected, no special case. Let all the customization of domain or path happen in the proxy. If someone is creating multiple entries, then they are already doing more advance things and will be using a proxy. For someone cloning an app or tinkering around, this needs to work without playing with the routes. They can goto login.html in that case. |
Also I currently use PUBLIC_URL with my multiple entry and index files: Line from my build command: |
Example k8s nginx-ingress manifest (replace apiVersion: "extensions/v1beta1"
kind: "Ingress"
metadata:
annotations:
acme.cert-manager.io/http01-edit-in-place: "true"
cert-manager.io/cluster-issuer: "letsencrypt"
kubernetes.io/ingress.class: "nginx"
kubernetes.io/tls-acme: "true"
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
nginx.ingress.kubernetes.io/configuration-snippet: "more_set_headers "Cache-Control: no-cache, no-store, max-age=0, must-revalidate";"
nginx.ingress.kubernetes.io/rewrite-target: "/index.html"
nginx.ingress.kubernetes.io/upstream-vhost: "app.monitormountain.com"
name: "app-monitormountain"
namespace: "ingress-nginx"
spec:
rules:
- host: "app.monitormountain.com"
http:
paths:
-
backend:
serviceName: "google-storage-buckets"
servicePort: "443"
path: "/"
tls:
-
hosts:
- "app.monitormountain.com"
secretName: "app-monitormountain" |
@bretep I think we misunderstood each other. In a CRA build is just a bunch of assets. |
okay, I think what you are asking for is a new base path for the entry point in dev, which is why you references the PUBLIC_URL as an example. Do I understand that correctly? |
That complicates things. What about listing on multiple ports. Each port is a new entry? |
Yes
Hmm, I think webpack-dev-server does not support multiple ports. I propose multi entry to be something similar with next.js pages |
I’m not sure how next.js does multiple entry. If we keep the “you can only work on one entry at a time” rule then you need to define This has the least amount of behavioral changes and allows multiple entry If you want to work on multiple at the same time, you need to develop behind a proxy (like I do). |
That was supposed in the beggining, but the idea is to have this
I don't really understand what is your use case with the proxy. I'm using proxy just to proxy dev environment API. |
I think if we focus just on making If I read the issue you linked correctly, there were some mixed issues there. Some can be solved with code splitting without the need of multiple entries.
You can create routes or domains that point to separate entry HTML files was my point. Not really all that important for this conversation. |
Hey guys, happy new year. Thank you so much by the whole discussion. I’m sure that we’re going to reach some goal here. My intention with this implementation is to allow the user add multiple entry points assuming that it’s going to generate separate bundles for each entry point. Why? With this approach implemented, we can serve different apps in order to not have the whole application in a single file. It also avoids the user to have 2 separate (cra) applications for this purpose. This also avoid the user to eject cra and lose all benefits of it, including th futures one. So, I hope we can reach a deal, but, independent our deal, it also needs the approvals from the reviewers, which maybe are offline for now. But I really hope to get a feedback from them. Stay blessed |
Hello @iansu @amyrlam @mrmckeb @ianschmitz @petetnt , I hope you're doing great! Please, let me know if there's something that I could be doing in order to get this PR reviewed by some of you. Thanks in advance |
My project already run eject, how do I modify to support it? |
You could have a look on this example: Or you could comparing the files of this PR and your files and change it in the same way. |
got it, |
Hey guys, any news for this PR? |
I think this is still not a robust solution, it needs more testing, and there are more edge cases that need to be caught. 🙁 🤷♂️ Try to make a rebase on top of master. PUBLIC_URL was added in development mode. |
Hi, any update on this feature? The security issue described by @DanZeuss is quite legit. |
Hey guys.. any updates for this PR? |
Stumbling upon this PR from Google while researching a similar solution, I think this suggestion has a lot of merit and could use some love to get the final push done. One suggestion, since even the comments on |
Would like to add a tiny bit to this; we're creating a tool-kit of embeddable third-party widgets in addition to our core products. Allowing us to build with separate bundles is critical. To be fair we don't even need the |
So now you see clearly that That's because CRA is actually intended for prototyping only, for quickly testing some ideas when you just need to bootstrap some simple tooling right away. The problem is that they announce it as a real tool instead! Which makes lots of confusions and frustration. Don't use it for real projects or you'll going to regret. (like we did) In our case, we've got a request from our customer to provide also a page with OpenAPI documentation. It could have be done quickly using this code: import React from 'react';
import SwaggerUI from 'swagger-ui-react';
import 'swagger-ui-react/swagger-ui.css';
export default function Api() {
return (
<SwaggerUI url="/path/to/api.json" />
);
} but the output bundle size get increased by 223% or 2.5 MB (!) of some code required by just one auxiliary page. I believe you'd agree that it's not acceptable. So what options do we have? Within the CRA philosophy - just none. Apparently, ejection is not an option as it's a thing quite opposite to CRA by its nature and to why it was chosen in the first place. Because instead of a simple setup you immediately get a pile of confusing contraptions built on top of webpack and which you need to learn now. The only option is to build a static HTML page from now on and maintain it manually. That's all very disappointing. |
Hi reviewer.
The intention of this PR is to provide a solution for the following (3 years old) issue:
#1084
The implementation doesn't require
eject
process.The instruction to test it is:
.html
and.js
fileappPages
in yourpackage.json
file. The structure must follow this shape:You can see it running on the following gif
Thank you so much by giving me this chance.