-
Notifications
You must be signed in to change notification settings - Fork 3
/
wxt.config.ts
71 lines (66 loc) · 2.12 KB
/
wxt.config.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { defineConfig, type ConfigEnv, type WxtViteConfig } from 'wxt';
import { svelte, vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import type { Manifest } from 'wxt/browser';
import path from 'node:path';
const releaseVersion = '0.8.6';
const getViteConfig: (env: ConfigEnv) => WxtViteConfig | Promise<WxtViteConfig> = () => {
return {
plugins: [
svelte({
// Using a svelte.config.js file causes a segmentation fault when importing the file
configFile: false,
preprocess: [vitePreprocess()],
onwarn(warning, defaultHandler) {
if (warning.code === 'a11y-click-events-have-key-events') return;
// handle all other warnings normally
defaultHandler?.(warning);
},
}),
],
build: {
sourcemap: true,
},
resolve: {
alias: {
$lib: path.resolve('./src/lib'),
},
},
};
};
const getManifest: (env: ConfigEnv) => Partial<Manifest.WebExtensionManifest> = (env) => {
const manifest: Partial<Manifest.WebExtensionManifest> = {
name: 'BetterBuff',
description: 'Enhance your website experience on Buff163',
version: releaseVersion,
host_permissions: ['*://*.buff.163.com/*'],
permissions: ['storage'],
web_accessible_resources: [
{
resources: ['inject.js', 'ch_patterns.json'],
matches: ['*://*.buff.163.com/*'],
},
],
};
if (env.browser === 'firefox') {
manifest.developer = {
name: 'Rums',
url: 'https://github.com/GODrums',
};
manifest.browser_specific_settings = {
gecko: {
id: '[email protected]',
strict_min_version: '109.0',
},
};
}
return manifest;
};
// See https://wxt.dev/api/config.html
export default defineConfig({
srcDir: 'src',
manifest: getManifest,
vite: getViteConfig,
runner: {
disabled: true,
},
});