* @param {Pick } options
(options)
| 6 | * @param {Pick<import('esbuild').BuildOptions, 'outfile' | 'format' | 'entryPoints' | 'write'>} options |
| 7 | */ |
| 8 | async function buildTemplate(options) { |
| 9 | return build({ |
| 10 | bundle: true, |
| 11 | entryPoints: options.entryPoints, |
| 12 | format: options.format, |
| 13 | legalComments: 'none', |
| 14 | minify: process.env.NODE_ENV !== 'test', |
| 15 | outfile: options.outfile, |
| 16 | // Cloudflare Workers uses the V8 JavaScript engine from Google Chrome. |
| 17 | // The Workers runtime is updated at least once a week, to at least the version |
| 18 | // that is currently used by Chrome's stable release. |
| 19 | // To see the latest stable chrome version: https://www.chromestatus.com/features/schedule |
| 20 | target: 'esnext', |
| 21 | write: options.write, |
| 22 | external: ['async_hooks'], // available in edge runtime |
| 23 | }); |
| 24 | } |
| 25 | |
| 26 | async function buildNextjsWrapper() { |
| 27 | const { outputFiles } = await buildTemplate({ |
no test coverage detected