-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.js
33 lines (28 loc) · 914 Bytes
/
build.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
const { build } = require('esbuild');
const copyStaticFiles = require('esbuild-copy-static-files');
const svgr = require('esbuild-plugin-svgr');
const fs = require('fs');
async function runBuild() {
// delete embeddable index
fs.rm('./dist', { recursive: true, force: true }, (err) => { });
// delete dist folder
fs.rm('./public/embeddable/index.html', { recursive: true, force: true }, (err) => { });
build({
entryPoints: ['src/content.js', 'src/popup.js', 'src/sw.js', 'src/root.jsx'],
loader: { '.js': 'jsx', '.png': 'dataurl' },
bundle: true,
jsx: 'automatic',
write: true,
outdir: 'dist',
plugins: [
copyStaticFiles({
src: './public',
dest: './dist',
dereference: true,
recursive: true,
}),
svgr()
]
})
}
runBuild();