-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
55 lines (50 loc) · 1.33 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
48
49
50
51
52
53
54
55
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import sassDts from "vite-plugin-sass-dts";
import path from "path";
import eslint from "vite-plugin-eslint";
import svgr from "vite-plugin-svgr";
const pathSrc = path.resolve(__dirname, "./src");
const config = ({ mode }) => {
process.env = Object.assign(process.env, loadEnv(mode, process.cwd(), ""));
return defineConfig({
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "@/styles" as common; @use "${pathSrc}/util/breakpoints/breakpoints" as media ;`,
importer(...args) {
if (args[0] !== "@/styles") {
return;
}
return {
file: `${pathSrc}`,
};
},
},
},
},
plugins: [
svgr({ svgrOptions: { titleProp: true } }),
react(),
sassDts({
enabledMode: ["development", "production"],
global: {
generate: true,
outFile: `${pathSrc}/style.d.ts`,
},
}),
eslint({
// failOnWarning: true,
}),
],
server: {
host: true,
port: parseInt(process.env.VITE_CLIENT_PORT_DEV!),
},
preview: {
host: true,
port: parseInt(process.env.VITE_CLIENT_PORT_PROD!),
},
});
};
export default config;