-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
52 lines (42 loc) · 1.21 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
import react from '@vitejs/plugin-react'
// import reactRefresh from '@vitejs/plugin-react-refresh'
import path from 'path'
import { defineConfig } from 'vite'
import { esbuildCommonjs } from '@originjs/vite-plugin-commonjs'
export default defineConfig({
plugins: [
react(),
// reactRefresh(),
],
optimizeDeps: {
esbuildOptions: {
plugins: [
esbuildCommonjs(['react-calendar', 'react-date-picker', 'react-clock', 'react-time-picker']),
],
},
},
// config
root: 'src',
base: process.env.APP_ENV === 'development' ? '/' : '/dist/',
build: {
// output dir for production build
outDir: '../public/dist',
emptyOutDir: true,
// emit manifest so PHP can find the hashed files
manifest: true,
target: 'es2015',
// our main entry
rollupOptions: { input: path.resolve(__dirname, 'src/index.jsx') },
commonjsOptions: { transformMixedEsModules: true },
},
server: {
origin: 'http://localhost:3001',
// required to load scripts from custom host
cors: true,
// we need a strict port to match on PHP side
strictPort: true,
port: 3001,
hmr: { host: 'localhost' },
commonjsOptions: { transformMixedEsModules: true },
},
})