-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.mjs
41 lines (38 loc) · 1005 Bytes
/
build.mjs
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
/*
build.mjs
Custom Vite build script for extension files,
to execute after default build finishes its work.
*/
import { build } from 'vite';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const extScripts = [
{
entry: path.resolve(__dirname, 'js/iframe.js'),
fileName: 'iframe'
},
/*
If later you decide to add a background service worker.
*/
// {
// entry: path.resolve(__dirname, 'src-browser-ext/background-sw.ts'),
// fileName: 'background-sw'
// }
];
extScripts.forEach(async (scr) => {
await build({
build: {
// Weather to add sourcemap or not
// make it false if not required
sourcemap: 'inline',
outDir: './dist',
lib: {
...scr,
formats: ['es']
},
emptyOutDir: false
},
configFile: false
});
});