-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
79 lines (73 loc) · 2.43 KB
/
Copy pathvite.config.ts
File metadata and controls
79 lines (73 loc) · 2.43 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { defineConfig, loadEnv } from "vite";
import { VitePWA } from "vite-plugin-pwa";
import react from "@vitejs/plugin-react";
import path from "path";
export default ({ mode }: { mode: string }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
return defineConfig({
plugins: [
react(),
VitePWA({
registerType: "autoUpdate",
injectRegister: false,
pwaAssets: {
disabled: false,
config: true,
},
manifest: {
name: "react-template-demo",
short_name: "react-template-demo",
description: "Nventive React Template Demo",
theme_color: "#ffffff",
},
workbox: {
globPatterns: ["**/*.{js,css,html,svg,png,ico}"],
cleanupOutdatedCaches: true,
clientsClaim: true,
},
devOptions: {
enabled: true,
navigateFallback: "index.html",
suppressWarnings: true,
type: "module",
},
}),
],
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "./src/styles/_variables.scss";`,
},
},
},
build: {
sourcemap: process.env.VITE_GENERATE_SOURCEMAP === "true",
},
server: {
port: Number(process.env.VITE_PORT),
},
define: {
__ENV__: JSON.stringify(process.env.VITE_ENV),
__API_URL__: JSON.stringify(process.env.VITE_API_URL),
__VERSION_NUMBER__: JSON.stringify(process.env.VITE_VERSION_NUMBER),
__GA_TRACKING_ID__: JSON.stringify(process.env.VITE_GA_TRACKING_ID),
},
resolve: {
alias: {
"@assets": path.resolve(__dirname, "src/assets"),
"@components": path.resolve(__dirname, "src/app/components"),
"@containers": path.resolve(__dirname, "src/app/containers"),
"@enums": path.resolve(__dirname, "src/app/enums"),
"@forms": path.resolve(__dirname, "src/app/forms"),
"@hocs": path.resolve(__dirname, "src/app/hocs"),
"@icons": path.resolve(__dirname, "src/app/icons"),
"@pages": path.resolve(__dirname, "src/app/pages"),
"@routes": path.resolve(__dirname, "src/app/routes"),
"@services": path.resolve(__dirname, "src/app/services"),
"@shared": path.resolve(__dirname, "src/app/shared"),
"@stores": path.resolve(__dirname, "src/app/stores"),
"@styles": path.resolve(__dirname, "src/styles"),
},
},
});
};