-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Description
Feature Request
A cold require of @babel/core for the first time, can take 400ms->500ms even on a fast machine.
This is quite high, especially for smaller projects, as their complete babel compilation time may be less than that.
Idea
Thoughts on mimic'ing yarn, and bundling @babel/core with webpack? My experiments suggest this can lead to a nice boost, with relatively minimal cost.
// after a clean install
load babel-core.bundle.js: 79.151ms
load babel-core: 449.058ms
// once the disk is warm
load babel-core.bundle.js: 79.151ms
load babel-core: 170.081ms
early POC: https://github.com/stefanpenner/babel-core.bundle
Some issues
It does appear, additional configuration/cleanup will be required to ensure various internals resolve correctly. As doing so via my naive approach appears to break some babel plugins. This may or may not be a show stopper.
For example:
Error: Cannot find module '/Users/spenner/src/babel/broccoli-babel-transpiler/node_modules/@babel/plugin-transform-strict-mode/lib/index.js'
at r (node_modules/@babel/core/dist/babel-core.bundle.js:1:443324)
at A (node_modules/@babel/core/dist/babel-core.bundle.js:1721:50205)
at t.loadPlugin (node_modules/@babel/core/dist/babel-core.bundle.js:1721:48335)
at m (node_modules/@babel/core/dist/babel-core.bundle.js:1:445869)
at t.map (node_modules/@babel/core/dist/babel-core.bundle.js:1:445008)
at Array.map (<anonymous>)
at h (node_modules/@babel/core/dist/babel-core.bundle.js:1:444997)
at d (node_modules/@babel/core/dist/babel-core.bundle.js:1:444947)
at t (node_modules/@babel/core/dist/babel-core.bundle.js:1:444350)
at /Users/spenner/src/babel/broccoli-babel-transpiler/node_modules/@babel/core/dist/babel-core.bundle.js:1:89995
at plugins.n (node_modules/@babel/core/dist/babel-core.bundle.js:1:443820)
at k (node_modules/@babel/core/dist/babel-core.bundle.js:1:451988)
at O (node_modules/@babel/core/dist/babel-core.bundle.js:1:451411)
at t.buildRootChain (node_modules/@babel/core/dist/babel-core.bundle.js:1:447284)
at f (node_modules/@babel/core/dist/babel-core.bundle.js:1:459282)
at t.default (node_modules/@babel/core/dist/babel-core.bundle.js:1721:51447)
at a (node_modules/@babel/core/dist/babel-core.bundle.js:1721:58326)
at Object.o (node_modules/@babel/core/dist/babel-core.bundle.js:1721:58138)
Question
So if this startup perf boost via bundling sounds appealing, I'll gladly explore/debug the above issues further.
Just let me know.