-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
45 lines (39 loc) · 1.11 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
/**
* View your website at your own local server.
* Example: if you're using WP-CLI then the common URL is: http://localhost:8080.
*
* http://localhost:5173 is serving Vite on development. Access this URL will show empty page.
*
*/
import { defineConfig } from "vite";
import { resolve } from 'path';
export default defineConfig({
plugins: [
{
handleHotUpdate({ file, server }) {
if (file.endsWith('.php')) {
server.ws.send({ type: 'full-reload', path: '*' });
}
}
}
],
build: {
// emit manifest so PHP can find the hashed files
manifest: true,
rollupOptions: {
input: {
main: resolve(__dirname + '/main.js')
},
}
},
server: {
// required to load scripts from custom host
cors: {
origin: "*"
},
// We need a strict port to match on PHP side.
// You can change it. But, please update it on your .env file to match the same port
strictPort: true,
port: 5173
},
});