-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.mts
85 lines (83 loc) · 2.62 KB
/
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
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
80
81
82
83
84
85
/// <reference types="vite/client" />
import { UserConfig, defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
export const config: UserConfig = {
root: "./src",
envDir: "../",
plugins: [react()],
resolve: {
//alias paths so that the import statements are shorter and start from the src folder
alias: {
components: path.resolve(__dirname, "./src/components"),
"http-client": path.resolve(__dirname, "./src/http-client"),
packages: path.resolve(__dirname, "./src/packages"),
pages: path.resolve(__dirname, "./src/pages"),
public: path.resolve(__dirname, "./src/public"),
store: path.resolve(__dirname, "./src/store"),
typings: path.resolve(__dirname, "./src/typings"),
utils: path.resolve(__dirname, "./src/utils"),
stream: "stream-browserify", //for plotly.js
},
},
//server configurations for running vite as a server (only happens in local dev). On docker/production, nginx serves the front end
server: {
// neither of these proxies are hit when running under docker:dev because nginx intercepts them
proxy: {
"/api/v1": {
target: "http://localhost:3001/",
changeOrigin: true,
ws: true,
},
"/static": {
target: "http://localhost:3001/",
changeOrigin: true,
},
},
watch: {
// During development, ignore these folders for hot reloading
ignored: ["**/node_modules/**", "**/.local/**", "**/public/**, **/static/**"],
},
host: "0.0.0.0", // all hosts
port: 3000,
},
build: {
outDir: "../.local/vite/dist",
assetsDir: "assets",
sourcemap: true,
manifest: true,
chunkSizeWarningLimit: 1500,
rollupOptions: {
output: {
// Creates a separate bundles for each of these chunks so there isn't one huge bundle.js file
manualChunks: {
react: [
"react",
"react-dom",
"react-redux",
"react-router-dom",
"@reduxjs/toolkit",
"react-modal",
"react-lazy-load-image-component",
"react-cookie",
],
plotly: ["plotly.js-basic-dist"],
mapbox: ["mapbox-gl"],
fonts: [
"@fortawesome/fontawesome-svg-core",
"@fortawesome/free-regular-svg-icons",
"@fortawesome/free-solid-svg-icons",
"@fortawesome/react-fontawesome",
],
paper: ["paper"],
},
},
external: ["path", "os", "crypto"],
},
},
define: {
global: {},
},
};
// https://vitejs.dev/config/
export default defineConfig(config);