-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.ts
43 lines (42 loc) · 1.15 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
import { defineConfig } from "vite";
import strip from "@rollup/plugin-strip";
import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";
import { resolve } from "path";
import nodePolyfills from "rollup-plugin-polyfill-node";
import { viteExternalsPlugin } from "vite-plugin-externals";
import inject from "@rollup/plugin-inject";
const externalPlugin = viteExternalsPlugin({
...{
electron: "electron",
"electron-fetch": "electron-fetch",
},
});
// https://vitejs.dev/config/
export default defineConfig({
plugins: [strip(), react(), tsconfigPaths(), externalPlugin],
// build: {
// sourcemap: true,
// commonjsOptions: {
// include: /node_modules/,
// transformMixedEsModules: true,
// ignoreTryCatch: false,
// },
// },
resolve: {
alias: {
stream: "stream-browserify",
url: "url-polyfill",
// fs: resolve("./node_modules/path-browserify"),
http: "http-browserify",
https: "http-browserify",
process: "process-es6",
"~~": resolve(__dirname, "src"),
},
},
build: {
commonjsOptions: {
transformMixedEsModules: true,
},
},
});