-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
66 lines (62 loc) · 1.9 KB
/
vite.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
import { crx, defineManifest } from '@nico-martin/crxjs-vite-plugin';
import preact from '@preact/preset-vite';
import { defineConfig } from 'vite';
import { version, title, description } from './package.json';
const [major, minor, patch, label = '0'] = version
.replace(/[^\d.-]+/g, '')
.split(/[.-]/);
const manifest = defineManifest(async (env) => ({
name: (env.mode === 'staging' ? '[INTERNAL] ' : '') + title,
description,
manifest_version: 3,
background: {
service_worker: 'src/serviceWorker/serviceWorker.ts',
},
content_scripts: [
{
matches: ['<all_urls>'],
js: ['src/contentScript/contentScript.ts'],
},
],
permissions: ['aiLanguageModelOriginTrial', 'activeTab'],
trial_tokens: [
'AhQwihN/6tvpHCMPUcXE/k4eEmugYRr5RNRr16r9zixTUDqtVhnIVopBz3JpT63umN/Ih2hPWnLjBzIAy7oUjQcAAAB4eyJvcmlnaW4iOiJjaHJvbWUtZXh0ZW5zaW9uOi8vamxrampramFhbHBvZG5nZGlmYWZpamttbW1rZmJuZmUiLCJmZWF0dXJlIjoiQUlQcm9tcHRBUElGb3JFeHRlbnNpb24iLCJleHBpcnkiOjE3NjA0ODYzOTl9',
],
action: {
default_title: 'Ask my Website',
default_popup: 'src/popup.html',
default_icon: {
'16': 'src/icons/16x.png',
'32': 'src/icons/32x.png',
'48': 'src/icons/48x.png',
'128': 'src/icons/128x.png',
},
},
icons: {
'16': 'src/icons/16x.png',
'32': 'src/icons/32x.png',
'48': 'src/icons/48x.png',
'128': 'src/icons/128x.png',
},
version: `${major}.${minor}.${patch}.${label}`,
version_name: version,
}));
export default defineConfig((config) => {
console.log('CONFIG', config);
return {
plugins: [preact(), crx({ manifest })],
...(config.mode === 'development'
? {
build: {
rollupOptions: {
output: {
entryFileNames: '[name].js',
chunkFileNames: '[name].js',
assetFileNames: '[name].[ext]',
},
},
},
}
: {}),
};
});