Open History to see the last commit
1import { cloudflare } from "@cloudflare/vite-plugin";
2import mdx from "@mdx-js/rollup";
3import rehypeShiki from "@shikijs/rehype";
4import tailwindcss from "@tailwindcss/vite";
5import { devtools } from "@tanstack/devtools-vite";
6import { tanstackStart } from "@tanstack/react-start/plugin/vite";
7import viteReact from "@vitejs/plugin-react";
8import { defineConfig } from "vite";
9import viteTsConfigPaths from "vite-tsconfig-paths";
10
11const config = defineConfig({
12 // server: {
13 // host: true,
14 // hmr: {
15 // host: "localhost", // or leave undefined for all
16 // },
17 // allowedHosts: [".localhost"],
18 // },
19 plugins: [
20 devtools(),
21 cloudflare({ viteEnvironment: { name: "ssr" } }),
22 // this is the plugin that enables path aliases
23 viteTsConfigPaths({
24 projects: ["./tsconfig.json"],
25 }),
26 tailwindcss(),
27 tanstackStart(),
28 viteReact(),
29 mdx({
30 rehypePlugins: [
31 [
32 rehypeShiki,
33 {
34 themes: {
35 light: "material-theme-lighter",
36 dark: "material-theme-darker",
37 },
38 defaultColor: false,
39 transformers: [
40 {
41 name: "add-language-data-attribute",
42 pre(node: { properties: Record<string, string> }) {
43 const lang = (
44 this as unknown as { options: { lang?: string } }
45 ).options.lang;
46 if (lang) {
47 node.properties["data-language"] = lang;
48 }
49 },
50 },
51 ],
52 },
53 ],
54 ],
55 }),
56 ],
57 optimizeDeps: {
58 exclude: ["@electric-sql/pglite"],
59 },
60});
61
62export default config;