-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: add option to public path cdn #398
Conversation
Thanks for the pull request, @johanv26! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
Hi @johanv26, thank you for this contribution! Are the changes ready for review? |
Yes, they are. Thanks for your attention. |
@johanv26 No problem! I'm marking this as ready for a test run. |
Hey @arbrandes, based on Ed's request for review above I just wanted to check in and see if this PR is on your radar? It doesn't seem to have made it into your queue yet. |
Indeed, it wasn't on the review queue yet, in spite of having assigned myself. Adding it now! |
Great, thanks @arbrandes! |
Hey @arbrandes, any updates on when you might get around to reviewing this PR? CC @johanv26 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't doubt that the handling of PUBLIC_PATH
in frontend-build and frontend-platform is too overloaded and thus prone to edge-case failures like the one described here, I'd first like to understand exactly that the failure being fixed is, so that we can:
- Document how to work around it by using a separate variable like you suggest here;
- Write unit tests that shield us from similar cases in the future.
With that in mind, do you mind giving us a step-by-step of how to reproduce the problem being fixed here?
ProblemThis is something that appears when you want to host MFE in buckets or use CDN to speed its loading.
ReproduceOk, I am going to describe how to reproduce the problem. So with that change, the learning MFE would stop working. CauseResearching a little I found that problem is the history module because the PublicPath is used in this module as basename. Current solutionMy current solution is to configure 2 variables for the "PublicPath". one for webpack and the other one for history code would use.
With this solution webpack would use |
I see the problem. But if we introduce a related but separately defined variable, then you force the operator to keep both of them synchronized, otherwise things will fail in different ways. What would it take for us to support PUBLIC_PATH as Webpack originally intended it, instead? |
I was thinking about whether and is possible to support PUBLIC_PATH as Webpack originally intended it ... fix it in frontend-platform. |
@johanv26, yes, that last suggestion seems like a good path forward! Particularly if you can come up with some good unit tests to go with it! ;) |
Thanks @arbrandes, as you recommended I start the process with a PR in frontend-platform. I also add some unittests. |
1 similar comment
Thanks @arbrandes, as you recommended I start the process with a PR in frontend-platform. I also add some unittests. |
@johanv26 Does openedx/frontend-platform#568 replace the changes from this PR, or complement them? In other words, are the changes from this PR still needed or would it make sense to close this PR? |
@itsjeyd it makes sense to close this PR in favor of the frontend-platform PR. openedx/frontend-platform#568 has the solution, but this PR msgs conserve some context. |
@johanv26 Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future. |
1 similar comment
@johanv26 Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future. |
Description
The idea of this commit is to add the option to manage the
publicPath
of webpack to use CDN routing.Here you can see that this is managed by webpack, the problem is that
publicPath
is also used in frontend platform with other purposes. So if I override publicPath the built is loading statics from the CDN in the correct behaviour but frontend platform starts with problems.webpack recomendation
https://webpack.js.org/configuration/output/#outputpublicpath
frontend platform
https://github.com/openedx/frontend-platform/blob/master/src/initialize.js#L102
So with this change, I can affect only the web pack behavior without affecting the history web browser of the frontend platform.
Before
After