-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
81 lines (80 loc) · 1.94 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { crx } from "@crxjs/vite-plugin";
// @ts-ignore
import manifest from "./manifest";
import viteSvgr from "vite-plugin-svgr";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import path from "path";
import wasmPack from "vite-plugin-wasm-pack";
import tsconfigPaths from "vite-tsconfig-paths";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
build: {
target: "es2020",
commonjsOptions: {
// https://github.com/originjs/vite-plugins/issues/9#issuecomment-924668456
transformMixedEsModules: true,
},
minify: mode === "production",
assetsInlineLimit: 0,
rollupOptions: {
input: {
offscreen: "./offscreen.html",
// offscreen_tx: "./offscreen_tx.html",
},
output: {
entryFileNames: "[name].js",
format: "esm",
},
},
},
server: {
port: 5173,
strictPort: true,
hmr: {
port: 5173,
},
},
optimizeDeps: {
esbuildOptions: {
target: "es2020",
define: {
global: "globalThis",
},
},
exclude: [],
},
esbuild: {
pure:
mode === "production" ? ["console.log", "console.debug", "debugger"] : [],
jsxInject: `import React from 'react'`,
},
resolve: {
alias: [
{ find: "@", replacement: path.resolve(__dirname, "app") },
{ find: "core", replacement: path.resolve(__dirname, "core") },
{ find: "aleo", replacement: path.resolve(__dirname, "aleo") },
],
},
define: {},
plugins: [
tsconfigPaths(),
viteSvgr({
exportAsDefault: true,
}),
nodePolyfills({
exclude: [],
globals: {
Buffer: true,
global: true,
process: true,
},
// Whether to polyfill `node:` protocol imports.
protocolImports: true,
}),
react(),
wasmPack(["./@aleohq/aleo_wasm"]),
crx({ manifest }),
],
}));