-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
39 lines (38 loc) · 993 Bytes
/
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
import { defineConfig, loadEnv } from "vite";
import { resolve } from "path";
import type { ConfigEnv, UserConfigExport } from "vite";
import { name as pkgName } from "./package.json";
import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default (): UserConfigExport => {
return defineConfig({
envDir: "env",
envPrefix: "GAO_",
plugins: [react()],
build: {
target: "esnext",
emptyOutDir: true,
sourcemap: false,
},
server: {
strictPort: true,
port: 8008,
host: true,
},
css: {
modules: {
generateScopedName: "[name]_[local]_[hash:base64:5]",
hashPrefix: pkgName,
},
preprocessorOptions: { less: { javascriptEnabled: true } },
},
resolve: {
alias: {
// @ 替代为 src
"@": resolve(__dirname, "src"),
// @component 替代为 src/component
"@components": resolve(__dirname, "src/components"),
},
},
});
};