-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
42 lines (40 loc) · 1.03 KB
/
Copy pathvite.config.ts
File metadata and controls
42 lines (40 loc) · 1.03 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import path from "path";
const emptyShim = path.resolve(__dirname, "src/shims/empty.ts");
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
nodePolyfills({
// Enable polyfills for specific modules
// Needed for sql.js
include: ["fs", "stream", "crypto", "buffer", "path", "util"],
globals: {
Buffer: true,
process: true,
},
}),
],
server: {
port: 3000,
open: true,
},
build: {
outDir: "build",
},
assetsInclude: ["**/*.wasm"],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
// PGLite imports these Node subpaths which polyfill mocks don't support.
// PGLite detects browser environment and doesn't actually use them.
"stream/promises": emptyShim,
"fs/promises": emptyShim,
},
},
optimizeDeps: {
exclude: ["@electric-sql/pglite"],
},
});