-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
79 lines (68 loc) · 1.66 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { defineConfig } from "vite";
import preact from "@preact/preset-vite";
import { resolve } from "node:path";
import mdx from "@mdx-js/rollup";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import rehypeKatex from "rehype-katex";
import remarkMath from "remark-math";
import rehypeShiki from "@stefanprobst/rehype-shiki";
import * as shiki from "shiki";
const highlighter = await shiki.getHighlighter({ theme: "rose-pine-moon" });
import esbuild from "rollup-plugin-esbuild";
//import { ecsstatic } from "@acab/ecsstatic/vite";
import styleX from "vite-plugin-stylex";
export const build = {
assetsInlineLimit: 0,
minify: "esbuild",
rollupOptions: {
input: {
main: resolve(__dirname, "index.html"),
},
plugins: [
esbuild({
target: "esnext",
jsxFactory: "h",
jsxFragment: "Fragment",
}),
],
},
};
export const plugins = [
preact({
include: ["**/*.res.mjs"],
}),
styleX(),
//ecsstatic(),
nodePolyfills({
// Whether to polyfill `node:` protocol imports.
protocolImports: true,
}),
mdx({
rehypePlugins: [
// rehypeSlug,
rehypeKatex,
// rehypeInferReadingTimeMeta,
// rehypeCodeTitles,
[rehypeShiki, { highlighter }],
],
remarkPlugins: [remarkMath],
providerImportSource: "@mdx-js/preact",
}),
];
export default defineConfig({
base: "./",
esbuild: {
target: "esnext",
jsxFactory: "h",
jsxFragment: "Fragment",
jsxInject: `import { h, Fragment } from 'preact'`,
},
build,
test: {
globals: false,
environment: "jsdom",
root: __dirname,
setupFiles: ["./vitest-setup.js"],
},
plugins,
});