-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
89 lines (80 loc) · 2.16 KB
/
vite.config.ts
File metadata and controls
89 lines (80 loc) · 2.16 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
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
// import { sentryVitePlugin } from '@sentry/vite-plugin';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
import path from 'path';
import { cloudflare } from '@cloudflare/vite-plugin';
import tailwindcss from '@tailwindcss/vite';
// import { nodePolyfills } from 'vite-plugin-node-polyfills';
// https://vite.dev/config/
export default defineConfig({
optimizeDeps: {
exclude: ['format', 'editor.all'],
include: ['monaco-editor/esm/vs/editor/editor.api'],
force: true, // Force re-optimization on every start
},
// build: {
// rollupOptions: {
// output: {
// advancedChunks: {
// groups: [{name: 'vendor', test: /node_modules/}]
// }
// }
// }
// },
plugins: [
react(),
svgr(),
cloudflare({
configPath: 'wrangler.jsonc',
experimental: { remoteBindings: true },
}), // Add the node polyfills plugin here
// nodePolyfills({
// exclude: [
// 'tty', // Exclude 'tty' module
// ],
// // We recommend leaving this as `true` to polyfill `global`.
// globals: {
// global: true,
// },
// })
tailwindcss(),
// sentryVitePlugin({
// org: 'cloudflare-0u',
// project: 'javascript-react',
// }),
],
resolve: {
alias: {
// 'path': 'path-browserify',
// Add this line to fix the 'debug' package issue
debug: 'debug/src/browser',
// "@": path.resolve(__dirname, "./src"),
'@': path.resolve(__dirname, './src'),
'shared': path.resolve(__dirname, './shared'),
'worker': path.resolve(__dirname, './worker'),
},
},
// Configure for Prisma + Cloudflare Workers compatibility
define: {
// Ensure proper module definitions for Cloudflare Workers context
'process.env.NODE_ENV': JSON.stringify(
process.env.NODE_ENV || 'development',
),
global: 'globalThis',
// '__filename': '""',
// '__dirname': '""',
},
worker: {
// Handle Prisma in worker context for development
format: 'es',
},
server: {
allowedHosts: true,
},
// Clear cache more aggressively
cacheDir: 'node_modules/.vite',
build: {
sourcemap: true,
},
});