-
Notifications
You must be signed in to change notification settings - Fork 287
Expand file tree
/
Copy pathvite.workers.config.js
More file actions
42 lines (40 loc) · 1.19 KB
/
Copy pathvite.workers.config.js
File metadata and controls
42 lines (40 loc) · 1.19 KB
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
/**
* Sub-Store Workers - Vite 配置
*
* 重要说明:
* Cloudflare Vite 插件会自动处理 Worker 入口和静态资源。
* 但 Sub-Store 源码需要特殊的代码替换处理。
*/
import { defineConfig } from 'vite';
import { cloudflare } from '@cloudflare/vite-plugin';
import { createDashboardBuildParts } from './vite.shared.config.js';
const dashboard = createDashboardBuildParts();
export default defineConfig({
plugins: [
...dashboard.plugins,
cloudflare(),
],
resolve: dashboard.resolve,
environments: {
client: {
build: {
assetsDir: dashboard.assetsDir,
rollupOptions: {
input: dashboard.input,
external: dashboard.external,
},
},
},
},
optimizeDeps: dashboard.optimizeDeps,
// 开发服务器配置
server: {
strictPort: true,
cors: {
origin: '*',
methods: ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE', 'OPTIONS'],
allowedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization'],
credentials: true,
},
},
});