How Vercel Gets Their Bundles Small #109
thecodedrift
announced in
TIL
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The @vercel/nft (Node File Trace) package is responsible for a lot of Vercel's bundling magic. It statically analyzes files and can find non-JS dependencies in the execution path by spotting filesystem intersections via
readFile
andreadStream
calls.The result of this call is a list of only the files & directories you really needed to include in a given serverless lambda or edge function. It only deals in userland code, meaning a heavy
node_modules
import can still push you over the 50MB runtime limit if you're trying to run something like Puppeteer on the edge.This may eventually move to
turbotrace
, which is marked as experimental in the Next docs, but its unlikely to be anything other than a static analysis tool. That means a lot of the current nft bugs are also likely to exist or require retesting inturbotrace
.Beta Was this translation helpful? Give feedback.
All reactions