-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
executable file
·52 lines (46 loc) · 1.23 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
const WP_TEMPLATE_NAME = 'templatename';
import { defineConfig } from "vite";
import liveReload from "vite-plugin-live-reload";
import checker from "vite-plugin-checker";
const { resolve } = require("path");
// https://vitejs.dev/config
export default defineConfig({
plugins: [
liveReload(__dirname + "/**/*.php"),
checker({
typescript: true,
}),
],
// config
root: __dirname,
base: process.env.NODE_ENV === "development" ? "/" : "/dist/",
publicDir: `./wp/themes/${WP_TEMPLATE_NAME}`,
build: {
outDir: resolve(__dirname, `./dist/${WP_TEMPLATE_NAME}`),
emptyOutDir: true,
manifest: true,
// target: "es2018",
rollupOptions: {
input: {
main: resolve(__dirname + "/main.js"),
},
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: 'assets/[name].[ext]'
}
},
// minify: true,
write: true,
},
server: {
cors: true,
strictPort: true,
port: 3000,
https: false,
hmr: {
host: "localhost",
//port: 443
},
},
});