-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
43 lines (40 loc) · 1.15 KB
/
vite.config.js
File metadata and controls
43 lines (40 loc) · 1.15 KB
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
import { resolve } from "node:path";
import { defineConfig } from "vite";
import { htmlMinifierPlugin } from "vite-plugin-html-minifier";
import { ejsPlugin } from "./vite-plugin/ejs.js";
import { ejsReloadPlugin } from "./vite-plugin/ejs-reload.js";
import { BUILD_CONFIG } from "./vite-config/build.js";
import { EJS_CONFIG } from "./vite-config/ejs.js";
// https://nodejs.org/api/esm.html#importmetadirname
const __dirname = import.meta.dirname;
// TODO: try to write custom vite plugin to use index.ejs as entry point
// references:
// https://github.com/donnikitos/vite-plugin-php
// https://vite.dev/config/
export default defineConfig({
plugins: [
ejsPlugin({
data: EJS_CONFIG.data,
options: {
views: [resolve(__dirname, "components")],
},
}),
htmlMinifierPlugin({
removeEmptyAttributes: (attribute) => attribute === "ejs",
}),
ejsReloadPlugin({ dirname: __dirname }),
],
base: "/dev-challenges/guess-the-word",
build: {
rollupOptions: {
output: {
manualChunks: BUILD_CONFIG.manualChunks,
},
},
},
resolve: {
alias: {
"@": resolve(__dirname, "src"),
},
},
});