-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
101 lines (89 loc) · 2.28 KB
/
vite.config.js
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { fileURLToPath } from 'url';
import path from 'path';
import tailwindcss from 'tailwindcss';
import autoprefixer from 'autoprefixer';
import basicSsl from '@vitejs/plugin-basic-ssl'
import { compression } from 'vite-plugin-compression2'
import { ViteMinifyPlugin } from 'vite-plugin-minify'
import { chunkSplitPlugin } from 'vite-plugin-chunk-split';
import { visualizer } from 'rollup-plugin-visualizer';
import { nodePolyfills } from 'vite-plugin-node-polyfills'
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default defineConfig({
base: '/',
build: {
// sourcemap: true,
outDir: 'dist',
emptyOutDir:true,
// minify: 'terser',
rollupOptions: {
treeshake: true,
output:{
manualChunks: {
'react-venders': ['react', 'react-dom'],
'recharts-chunk': ['recharts'],
'd3-chunk': ['d3'],
// 'lodash-chunk': ['lodash'],
}}
}},
plugins: [
// nodePolyfills({
// include: ['process'],
// globals: { global: true, process: true },
// }),
// visualizer({ open: true, filename: 'bundle-visualization.html' }),
// chunkSplitPlugin(),
// ViteMinifyPlugin(),
compression(),
react(
{ jsxRuntime: 'automatic' })
],
css: {
postcss: {
plugins: [
tailwindcss(),
autoprefixer({
overrideBrowserslist: [
"> 1%",
"last 2 versions",
"not dead",
"not Safari < 9",
"not IE 11",
"not Edge < 79"
],
}),
],
}
},
optimizeDeps: {
// exclude: ['cjs-dep'],
// include: ['esm-dep > cjs-dep']
},
resolve: {
extensions: ['.js','.jsx','.ts','.tsx'],
alias: {
'styled-components': path.resolve(__dirname, 'node_modules', 'styled-components'),
// lodash: 'lodash-es',
},
},
preview: {
plugins:[ basicSsl()],
cors: {
origin: [
'https://carmagnole.ohnoimded.com',
],
credentials: true, // Allow credentials
},
port: 3001,
},
// for dev
server: {
port: 3001,
watch: {
usePolling: true
},
}
});