forked from Taneros/vite-for-making-layouts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
40 lines (38 loc) · 1.1 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
import { defineConfig } from "vite";
import embedTemplates from "./plugins/vite-template-plugin.js";
import moveHtmlFiles from "./plugins/move-html-files-plugin";
import getHtmlInputs from "./configs/getHtmlInputs.js";
import path from "path";
export default defineConfig({
base: "/vite-for-making-layouts/",
plugins: [embedTemplates(), moveHtmlFiles()],
publicDir: "src/public",
build: {
outDir: "build",
rollupOptions: {
input: {
main: path.resolve(__dirname, "index.html"),
...getHtmlInputs(path.resolve(__dirname, "src/pages")),
},
output: {
assetFileNames: (assetInfo) => {
if (assetInfo.name.endsWith(".css")) {
return "styles/[name].[ext]";
} else {
const ext = path.extname(assetInfo.name).slice(1);
return `assets/${ext}/[name].[ext]`;
}
},
entryFileNames: "[name].[hash].js",
chunkFileNames: "[name].js",
manualChunks: undefined,
},
},
},
server: {
watch: {
ignored: [],
paths: ["src/templates/**/*.template.html"],
},
},
});