-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvite.playground.config.mjs
More file actions
50 lines (47 loc) · 1.12 KB
/
vite.playground.config.mjs
File metadata and controls
50 lines (47 loc) · 1.12 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
44
45
46
47
48
49
50
import path from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vite";
import moonbit from "vite-plugin-moonbit";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const playgroundRoot = path.resolve(__dirname, "playground");
const playgroundDocsRoot = path.resolve(__dirname, "docs/playground");
export default defineConfig({
root: playgroundRoot,
base: "./",
plugins: [
moonbit({
target: "js",
mode: "release",
watch: false,
showLogs: true,
}),
],
server: {
host: "127.0.0.1",
port: 4175,
fs: {
allow: [__dirname],
},
},
preview: {
host: "127.0.0.1",
port: 4176,
},
build: {
outDir: playgroundDocsRoot,
emptyOutDir: true,
rollupOptions: {
output: {
entryFileNames: "app.js",
chunkFileNames: "chunks/[name]-[hash].js",
assetFileNames: (assetInfo) => {
const name = assetInfo.name ?? "";
if (name.endsWith(".css")) {
return "styles.css";
}
return "assets/[name]-[hash][extname]";
},
},
},
},
});