-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
60 lines (60 loc) · 1.83 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
import { defineConfig, loadEnv } from "vite";
import solid from "vite-plugin-solid";
import tsconfigPaths from "vite-tsconfig-paths";
import { sentryVitePlugin } from "@sentry/vite-plugin";
import { dirname, resolve } from "path";
const dir = dirname(new URL(import.meta.url).pathname);
export default defineConfig(({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
return {
server: { port: +(process.env.VITE_PORT ?? 3000) },
plugins: [
// nodePolyfills(),
tsconfigPaths({ loose: true }),
solid(),
sentryVitePlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "inio",
project: "inio-front-end",
telemetry: false,
}),
],
define: { "process.env.BABEL_TYPES_8_BREAKING": "true" },
build: {
target: "esnext",
polyfillDynamicImport: false,
minify: false,
chunkSizeWarningLimit: 600,
sourcemap: true,
rollupOptions: {
input: "./src/main.tsx",
output: {
assetFileNames: "[name][extname]",
chunkFileNames: "[name].js",
entryFileNames: "[name].js",
manualChunks: () => "main.js",
},
},
},
optimizeDeps: { esbuildOptions: { target: "esnext" } },
test: {
environment: "jsdom",
transformMode: { web: [/\\.[jt]sx?$/] },
threads: true,
isolate: true,
globals: true,
},
resolve: {
conditions: ["development", "browser"],
alias: [
{ find: "fs", replacement: resolve(dir, "src/fake-modules.ts") },
{ find: "path", replacement: resolve(dir, "src/fake-modules.ts") },
{
find: "source-map-js",
replacement: resolve(dir, "src/fake-modules.ts"),
},
{ find: "url", replacement: resolve(dir, "src/fake-modules.ts") },
],
},
};
});