-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
101 lines (87 loc) · 2.32 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import path from 'node:path'
import { crx } from '@crxjs/vite-plugin'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
export default defineConfig({
build: {
// TODO: temporary fix for "chunk size too large" error
chunkSizeWarningLimit: 2000,
outDir: 'dist',
emptyOutDir: true,
rollupOptions: {
input: {
index: path.resolve(__dirname, 'index.html'),
background: path.resolve(__dirname, 'src/background/index.ts'),
},
output: {
entryFileNames: (chunkInfo) => {
if (chunkInfo.name === 'background') {
return 'background.js'
}
return 'assets/[name].[hash].js'
},
chunkFileNames: 'assets/[name].[hash].js',
assetFileNames: 'assets/[name].[ext]',
},
},
},
plugins: [
react(),
crx({
manifest: {
manifest_version: 3,
name: 'Web Assistant',
version: '1.0.0',
description: 'Chat with your current Web, Ask anything about the current page',
icons: {
34: 'public/icon-34.png',
128: 'public/icon-128.png',
},
action: {
default_icon: {
34: 'public/icon-34.png',
128: 'public/icon-128.png',
},
default_title: 'Web Assistant',
},
background: {
service_worker: 'src/background/index.ts',
type: 'module',
},
side_panel: {
default_path: 'index.html',
},
permissions: [
'tabs',
'activeTab',
'scripting',
'notifications',
'sidePanel',
'commands',
'storage',
],
host_permissions: ['<all_urls>'],
content_security_policy: {
extension_pages: 'script-src \'self\' \'wasm-unsafe-eval\'; object-src \'self\';',
},
web_accessible_resources: [
{
matches: ['<all_urls>'],
resources: ['index.html'],
},
],
minimum_chrome_version: '102',
},
}),
],
css: {
postcss: './postcss.config.cjs',
},
resolve: {
alias: {
'@src': path.resolve(__dirname, './src'),
'@assets': path.resolve(__dirname, './src/assets'),
'@pages': path.resolve(__dirname, './src/pages'),
},
},
})