-
Notifications
You must be signed in to change notification settings - Fork 11
/
bundle.ts
30 lines (27 loc) · 793 Bytes
/
bundle.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
import * as esbuild from 'esbuild'
const config = {
entryPoints: [
'./src/index.ts',
'./src/locales/en/index.ts',
'./src/locales/fr/index.ts',
'./src/locales/fr-CA/index.ts',
'./src/locales/es/index.ts'
],
platform: 'node',
bundle: true,
external: [
'*/../index', // for accessing minifaker in locales folder
// keep them as external since they might already be installed... I can't really bundle them because I don't have the TS file generated :S
'nanoid',
'uuid'
//'seedrandom' // bundle seedrandom inside instead since we only we it internally
]
} as esbuild.BuildOptions
const formats = ['cjs', 'esm'] as esbuild.Format[]
formats.forEach(format => {
esbuild.build({
...config,
format,
outdir: `./dist/${format}`
})
})