-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
47 lines (45 loc) · 1.19 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
import {resolve} from "path";
import {defineConfig} from "vite";
import legacy from "@vitejs/plugin-legacy";
import basicSsl from "@vitejs/plugin-basic-ssl";
import liveReload from "vite-plugin-live-reload";
import getThemeDir from "./js-helpers/getThemeDir.mjs"; // https://vitejs.dev/config/
// https://vitejs.dev/config/
export const viteConfig = {
cacheDir: "./node_modules/.vite/press-wind",
plugins: [basicSsl(), liveReload([`${__dirname}+ "/**/*.php`]), legacy({})],
base:
process.env.APP_ENV === "development"
? `/wp-content/themes/${getThemeDir()}/`
: `/wp-content/themes/${getThemeDir()}/dist/`,
root: "",
// css: {
// transformer: "lightningcss",
// lightningcss: {
// targets: browserslistToTargets(browserslist(">= 0.25%")),
// },
// },
build: {
cssCodeSplit: true,
cssMinify: "lightningcss",
// output dir for production build
outDir: resolve(__dirname, "dist"),
emptyOutDir: true,
manifest: true,
rollupOptions: {
input: resolve(__dirname, "main.js"),
},
},
server: {
cors: true,
strictPort: true,
port: 3000,
https: true,
hmr: {
protocol: "wss",
port: 3000,
// host: 'localhost',
},
},
};
export default defineConfig(viteConfig);