-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.js
58 lines (55 loc) · 1.23 KB
/
vite.config.js
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
import { defineConfig } from "vite";
import reactRefresh from "@vitejs/plugin-react-refresh";
import path from "path";
import { fileURLToPath } from "url";
import { minify } from "terser";
import { config } from "dotenv";
config();
const dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
plugins: [reactRefresh()],
build: {
outDir: path.resolve(dirname, "dist"),
assetsDir: "",
rollupOptions: {
plugins: [
{
name: "minify",
renderChunk: async (code) => {
const result = await minify(code);
return { code: result.code, map: null };
},
},
],
},
emptyOutDir: true,
sourcemap: true,
optimizeDeps: {
include: ["react", "react-dom"],
},
},
server: {
port: 3000,
open: true,
strictPort: true,
proxy: {
"/api": `http://localhost:${process.env.PORT}`,
"/auth": `http://localhost:${process.env.PORT}`,
},
},
resolve: {
alias: {
"@": "/src",
},
},
css: {
modules: {
localsConvention: "camelCaseOnly",
},
preprocessorOptions: {
scss: {
additionalData: `@import "src/styles/variables.scss";`,
},
},
},
});