-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.mts
42 lines (38 loc) · 892 Bytes
/
vite.config.mts
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
/// <reference types="vitest" />
/// <reference types="vite/client" />
import { fileURLToPath } from "node:url";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
export type ViteConfigInput = {
mode: "development" | "production";
};
// https://vitejs.dev/config/
export default (args?: ViteConfigInput) => {
const generateScopedName =
args?.mode === "development"
? "[local]_[hash:base64:4]"
: "[hash:base64:4]";
return defineConfig({
base: "./",
build: {
emptyOutDir: true,
outDir: "./dist",
target: "es2022",
},
css: {
modules: {
generateScopedName,
localsConvention: "camelCase",
},
},
plugins: [react()],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
server: {
port: 3000,
},
});
};