-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite.config.ts
47 lines (45 loc) · 1.15 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
// @ts-ignore
// * No declaration file for less-vars-to-js
import lessToJS from "less-vars-to-js";
import { defineConfig } from "vite";
import reactRefresh from "@vitejs/plugin-react-refresh";
import vitePluginImp from "vite-plugin-imp";
import { ViteAliases } from "vite-aliases";
import Inspect from "vite-plugin-inspect";
import reactJsx from "vite-react-jsx";
import { resolve } from "path";
import fs from "fs";
const pathResolver = (path: string) => resolve(__dirname, path);
const themeVariables = lessToJS(
fs.readFileSync(pathResolver("./config/variables.less"), "utf8")
);
export default defineConfig({
base: "./",
plugins: [
Inspect(),
ViteAliases({}),
reactJsx(),
reactRefresh(),
vitePluginImp({
libList: [
{
libName: "antd",
style: (name) => {
if (name === "col" || name === "row") {
return "antd/lib/style/index.less";
}
return `antd/es/${name}/style/index.less`;
},
},
],
}),
],
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
modifyVars: themeVariables,
},
},
},
});