-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathesbuild.js
47 lines (41 loc) · 1.03 KB
/
esbuild.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const fs = require('fs');
const path = require('path');
const esbuild = require('esbuild');
const { clean } = require('esbuild-plugin-clean');
const { globalExternals } = require('@fal-works/esbuild-plugin-global-externals');
esbuild.build({
// Walks all import statements to transpile every file.
bundle: true,
// In case I am dumb and forget to delete code.
treeShaking: true,
plugins: [
globalExternals({
'@logger': {
varName: 'adn.logger'
},
'@apis': {
varName: 'adn.apis',
namedExports: ['sendNotification']
},
'@apis/settings': {
varName: 'adn.apis.Settings',
namedExports: ['create']
},
'@patcher': {
varName: 'adn.patcher'
}
}),
clean({
patterns: ['dist/**/*']
})
],
minify: true,
format: 'iife',
outdir: 'dist',
outbase: 'src',
jsx: 'transform',
sourcemap: 'inline',
entryPoints:
fs.readdirSync('./src')
.map(dir => path.join('src', dir, 'index.ts'))
}).catch(() => process.exit(1));