-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ts
33 lines (32 loc) · 1.09 KB
/
build.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { build } from 'esbuild'
import { copy } from 'esbuild-plugin-copy'
import textReplace from 'esbuild-plugin-text-replace'
await build({
bundle: true,
entryPoints: ['src/lambda.ts'],
outdir: 'dist',
outbase: 'src/',
sourcemap: 'inline',
platform: 'node',
format: 'esm',
target: 'es2022',
outExtension: { '.js': '.mjs' },
banner: {
js: "const require = (await import('node:module')).createRequire(import.meta.url);const __filename = (await import('node:url')).fileURLToPath(import.meta.url);const __dirname = (await import('node:path')).dirname(__filename);"
},
plugins: [
copy({
resolveFrom: 'cwd',
assets: {
from: ['node_modules/@fastify/swagger-ui/static/*'],
to: ['dist/static']
}
}),
// HACK: https://github.com/fastify/fastify-swagger-ui/issues/65#issuecomment-1857023801
// @ts-ignore
textReplace({
include: /node_modules\/@fastify\/swagger-ui\/lib\/routes\.js$/,
pattern: [[`'\.\.'`, `'.'`]]
})
]
})