forked from gmx-io/gmx-interface
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
95 lines (93 loc) · 2.88 KB
/
vite.config.ts
File metadata and controls
95 lines (93 loc) · 2.88 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
90
91
92
93
94
95
/// <reference types="vitest" />
import { lingui } from "@lingui/vite-plugin";
import react from "@vitejs/plugin-react";
import path from "path";
import { visualizer } from "rollup-plugin-visualizer";
import { defineConfig, type PluginOption } from "vite";
import { analyzer } from "vite-bundle-analyzer";
import svgr from "vite-plugin-svgr";
import tsconfigPaths from "vite-tsconfig-paths";
import { BREAKPOINTS } from "./src/lib/breakpoints";
export default defineConfig(({ mode }) => {
return {
worker: {
format: "es",
},
optimizeDeps: {
include: ["@vanilla-extract/sprinkles", "@rainbow-me/rainbowkit"],
esbuildOptions: {
target: "es2020",
},
},
css: {
preprocessorOptions: {
scss: {
additionalData: `
$screen-md: ${BREAKPOINTS.mobile}px;
$screen-lg: ${BREAKPOINTS.tablet}px;
$screen-xl: ${BREAKPOINTS.desktop}px;
$screen-sm: ${BREAKPOINTS.smallMobile}px;
`,
},
},
},
plugins: [
svgr({
include: "**/*.svg?react",
}),
tsconfigPaths(),
react({
babel: {
plugins: ["macros"],
},
}),
lingui(),
visualizer() as PluginOption,
mode === "analyze" && analyzer(),
],
resolve: {
alias: {
App: path.resolve(__dirname, "src/App"),
components: path.resolve(__dirname, "src/components"),
config: path.resolve(__dirname, "src/config"),
context: path.resolve(__dirname, "src/context"),
domain: path.resolve(__dirname, "src/domain"),
fonts: path.resolve(__dirname, "src/fonts"),
img: path.resolve(__dirname, "src/img"),
lib: path.resolve(__dirname, "src/lib"),
ab: path.resolve(__dirname, "src/ab"),
locales: path.resolve(__dirname, "src/locales"),
pages: path.resolve(__dirname, "src/pages"),
styles: path.resolve(__dirname, "src/styles"),
"typechain-types": path.resolve(__dirname, "src/typechain-types"),
prebuilt: path.resolve(__dirname, "src/prebuilt"),
sdk: path.resolve(__dirname, "sdk/src"),
},
},
build: {
assetsInlineLimit: 0,
outDir: "build",
sourcemap: true,
rollupOptions: {
output: {
manualChunks: {
web3: ["ethers", "viem", "date-fns", "@rainbow-me/rainbowkit", "lodash", "@gelatonetwork/relay-sdk"],
charts: ["recharts"],
ui: ["@headlessui/react", "framer-motion", "react-select"],
},
},
},
},
test: {
environment: "happy-dom",
globalSetup: "./vitest.global-setup.js",
exclude: ["./autotests", "node_modules", "./sdk"],
setupFiles: ["./src/lib/polyfills.ts", "@vitest/web-worker"],
server: {
deps: {
inline: ["@vanilla-extract/sprinkles", "@rainbow-me/rainbowkit"],
},
},
},
};
});