-
Notifications
You must be signed in to change notification settings - Fork 35
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
Remove babel from frontend-build (POC) #566
Conversation
Thanks for the pull request, @bradenmacdonald! 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. |
b367354
to
f7042e8
Compare
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.
This will break all libraries using babel-preserve-modules for their builds, which I believe is all of them. I don't think we can just unilaterally delete Babel without some preparation.
@davidjoy Well, first of all, this PR demonstrates that removing babel doesn't provide a very substantial improvement on its own, so even though I personally prefer to get rid of babel, I'm not even necessarily pushing for that after trying it out here. Part of this PR is just to gain information. But secondly, I'm not sure what you mean. I checked frontend-lib-content-components and paragon, two libraries I had open at the time, and neither reference |
"All of them" is apparently an exaggeration, but here's an example: https://github.com/openedx/frontend-component-header/blob/master/babel.config.js Paragon goes its own way, and I recall content components not following the established pattern when it was made. 😅 |
@davidjoy Right, but again, if we're not using babel, nothing is going to even try to read that |
@bradenmacdonald 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. |
This PR demonstrates two things:
swc-loader
devDependencies
so that when we just want to build and deploy an MFE, we don't need to bother installing those. This should greatly speed up the build/deploy process.I tested this with the example app and the course authoring MFE and it seems to be working but obviously a lot more testing would be required before something like this could be merged. So for now it's just a proof of concept.
Findings:
Based on running the command
npx howfat . --sort size-
Surprisingly, removing babel does not have a huge effect on the number of dependencies (about 300 less), and SWC is actually larger in terms of disk space (because it's a rust binary). Moving the horribly bloated
jest
andeslint
todevDependencies
has a much bigger impact.Before:
After removing babel:
After removing babel and moving test+lint requirements to
devDependencies
: