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