mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-06 12:57:46 +00:00
### Before ``` $ time pnpm run build > @vercel/next@4.0.6 build /Users/nrajlich/Code/vercel/vercel/packages/next > node build.js ncc: Version 0.24.0 ncc: Compiling file index.js ncc: Using typescript@4.9.5 (local user-provided) 1506kB dist/main/index.js 1506kB [3345ms] - ncc 0.24.0 real 0m5.210s user 0m9.083s sys 0m0.506s $ ls -l dist/ total 1700 -rw-r--r-- 1 nrajlich staff 2176 Sep 20 15:18 ___get-nextjs-edge-function.js -rw-r--r-- 1 nrajlich staff 3283 Sep 20 15:18 create-serverless-config.js drwxr-xr-x 6 nrajlich staff 192 Sep 20 15:18 edge-function-source/ -rw-r--r-- 1 nrajlich staff 1542314 Sep 20 15:18 index.js -rw-r--r-- 1 nrajlich staff 728 Sep 20 15:18 legacy-launcher.js -rw-r--r-- 1 nrajlich staff 6807 Sep 20 15:18 legacy-versions.js -rw-r--r-- 1 nrajlich staff 66662 Sep 20 15:18 server-build.js -rw-r--r-- 1 nrajlich staff 1583 Sep 20 15:18 server-launcher.js -rw-r--r-- 1 nrajlich staff 5167 Sep 20 15:18 sourcemapped.js -rw-r--r-- 1 nrajlich staff 1003 Sep 20 15:18 templated-launcher-shared.js -rw-r--r-- 1 nrajlich staff 799 Sep 20 15:18 templated-launcher.js -rw-r--r-- 1 nrajlich staff 83876 Sep 20 15:18 utils.js $ pnpm pack && ls -lh vercel-next-4.0.6.tgz -rw-r--r-- 1 nrajlich staff 373K Sep 20 15:19 vercel-next-4.0.6.tgz ``` ### After ``` $ time pnpm run build > @vercel/next@4.0.6 build /Users/nrajlich/Code/vercel/vercel/packages/next > node build.mjs real 0m1.144s user 0m0.550s sys 0m0.171s $ ls -l dist/ total 540 -rw-r--r-- 1 nrajlich staff 2176 Sep 20 15:15 ___get-nextjs-edge-function.js -rw-r--r-- 1 nrajlich staff 528575 Sep 20 15:15 index.js -rw-r--r-- 1 nrajlich staff 1680 Sep 20 15:15 legacy-launcher.js -rw-r--r-- 1 nrajlich staff 901 Sep 20 15:15 server-launcher.js -rw-r--r-- 1 nrajlich staff 532 Sep 20 15:15 templated-launcher-shared.js -rw-r--r-- 1 nrajlich staff 316 Sep 20 15:15 templated-launcher.js $ pnpm pack && ls -lh vercel-next-4.0.6.tgz -rw-r--r-- 1 nrajlich staff 104K Sep 20 15:15 vercel-next-4.0.6.tgz ```
20 lines
672 B
JavaScript
Vendored
20 lines
672 B
JavaScript
Vendored
/**
|
|
* This script is the build configuration common to all our Builder packages.
|
|
* We bundle the output using `esbuild`, and do not publish type definitions.
|
|
*
|
|
* `@vercel/build-utils` is marked as external because it's always an implicit
|
|
* dependency when the Builder is invoked by `vercel build`.
|
|
*/
|
|
import { join } from 'node:path';
|
|
import { readFileSync } from 'node:fs';
|
|
import { esbuild } from './build.mjs';
|
|
|
|
const pkgPath = join(process.cwd(), 'package.json');
|
|
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
const externals = Object.keys(pkg.dependencies || {});
|
|
|
|
await esbuild({
|
|
bundle: true,
|
|
external: ['@vercel/build-utils', ...externals],
|
|
});
|