[static-build] Use esbuild (#10462)

Switch to using esbuild to compile + bundle `@vercel/static-build`.
This commit is contained in:
Nathan Rajlich
2023-09-08 12:39:12 -07:00
committed by GitHub
parent 50e04dd858
commit b265e13d40
5 changed files with 31 additions and 24 deletions

20
utils/build-builder.mjs vendored Normal file
View File

@@ -0,0 +1,20 @@
/**
* 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],
});