-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Build Tooling: Explore faster builds split into individual packages #37318
Conversation
Size Change: +6.59 kB (+1%) Total Size: 1.11 MB
ℹ️ View Unchanged
|
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.
The swc
migration is surprisingly straightforward! It helps that Gutenberg doesn't use any custom plugins. Except @emotion/babel-plugin
which optimizes the css
syntax. That will need to be addressed somehow.
I liked the centralized bin/packages/build.js
script. I don't see much upside to copying the same stuff over and over in each of the package.json
s.
@@ -28,11 +28,25 @@ | |||
"react-native": "src/index", | |||
"types": "build-types", | |||
"dependencies": { | |||
"@babel/runtime": "^7.16.0", |
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.
The @babel/runtime
will need to be replaced by @swc/helpers
and the jsc.externalHelpers = true
config option. Otherwise all the helpers (for more complex transpilations like classes, async, iterators, ...) would be duplicated in each compiled file.
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.
yeah, I saw that, I wanted to check how much of a bundle size impact it would have to avoid the helpers.
@youknowriad Does this patch already compile JSX to To make it work with SWC, we'll probably need to move to the new
SWC lets you specify the With |
@jsnajdr it doesn't compile JSX yet, and the reason is mentioned on the description. (you're right about move to automatic but it's not that simple) |
This is on the Next.js roadmap as noted in https://nextjs.org/blog/next-12:
While this would work great for the Gutenberg plugin, it is suboptimal for npm packages published to npm. As far as I'm aware, libraries still ship code that uses direct access to |
There is also an open discussion started by @kevin940726 in #36142 about the general improvements to the build development workflow where we could summarize all the findings from this PR and from the efforts to start using |
Related to #36142.
This is not necessarily meant to land as is but more an exploration to see what's possible in the future.
My main motivation here was that the JS community has been evolving in the last couple years, there are new approaches, new toolings... and I wanted to see how other folks approach monorepos what makes sense for us to adopt. Some of the tools I've looked at:
Some of my own conclusions/notes:
Initial exploration in this PR:
In this particular PR, I trying seeing whether we can use one of the two most popular Rust/go based JS compilers instead of babel for our packages (swc or esbuild, I've tried both and used swc for now).
The first take away for me is that we could benefit from having each package define its own "build" command instead of handling this top-level, there are a couple advantages for this:
The other take away for me is related to the adoption of these rust/go builders and the removal of babel: We have too many babel specific logic in our chains that we should try to eliminate over time if we want to avoid the lock-in to last forever while the JS community abandons babel.
jsx-runtime
entry for the new automatic JSX transform #34221 (comment)Curious what you think about my ramblings and also the current PR (package specific builds, swc...)