-
Notifications
You must be signed in to change notification settings - Fork 181
/
Copy pathvite.config.js
58 lines (55 loc) · 1.22 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
53
54
55
56
57
58
import preact from "@preact/preset-vite";
import { resolve } from "node:path";
import { defineConfig } from "vitest/config";
const root = "./assets";
/**
* Rafraichi la page quand on modifie un fichier twig
*/
const twigRefreshPlugin = () => ({
name: "twig-refresh",
configureServer({ watcher, ws }) {
watcher.add(resolve(__dirname, "templates/**/*.twig"));
watcher.on("change", function (path) {
if (path.endsWith(".twig")) {
ws.send({
type: "full-reload",
});
}
});
},
});
export default defineConfig({
test: {
dir: "./tests/js",
},
resolve: {
alias: {
react: "preact/compat",
"react-dom": "preact/compat",
},
},
server: {
port: 3000,
host: "0.0.0.0",
},
emitManifest: true,
cors: true,
base: "/assets/",
build: {
outDir: "../public/assets/",
rollupOptions: {
output: {
manualChunks: undefined, // Désactive la séparation du vendor
},
input: {
app: resolve(__dirname, "assets/app.js"),
admin: resolve(__dirname, "assets/admin.js"),
},
},
polyfillDynamicImport: false,
assetsDir: "",
manifest: true,
},
plugins: [preact(), twigRefreshPlugin()],
root,
});