-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.js
35 lines (32 loc) · 996 Bytes
/
vite.config.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
import { defineConfig } from 'vite';
import webExtension, { readJsonFile } from 'vite-plugin-web-extension';
// eslint-disable-next-line no-undef
const target = process.env.TARGET || 'chrome';
export default defineConfig({
define: {
__BROWSER__: JSON.stringify(target),
}, build: {
outDir: `dist/${target}`,
emptyOutDir: true,
sourcemap: true,
}, plugins: [
webExtension({
verbose: true,
browser: target, manifest: () => {
// Use `readJsonFile` instead of import/require to avoid caching during rebuild.
const pkg = readJsonFile('package.json');
const template = readJsonFile(target === 'chrome' ? 'manifest.chrome.json' : 'manifest.firefox.json');
return {
...template,
version: pkg.version,
name: pkg.name,
description: pkg.description,
};
},
additionalInputs: [
'src/contentTab.js',
'src/content/windowEventRecorder.js'
]
})
],
});