-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
75 lines (72 loc) · 2.22 KB
/
vite.config.ts
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
/* eslint-disable @typescript-eslint/no-explicit-any */
// import a11yEmoji from "@fec/remark-a11y-emoji";
import { nodeTypes } from "@mdx-js/mdx";
import mdx from "@mdx-js/rollup";
import rehypeExternalLinks from "rehype-external-links";
import rehypeKatex from "rehype-katex";
import rehypeRaw from "rehype-raw";
import rehypeSlug from "rehype-slug";
import remarkFrontmatter from "remark-frontmatter";
import remarkGfm from "remark-gfm";
import remarkMath from "remark-math";
import remarkMdxImages from "remark-mdx-images";
import remarkShikiTwoslash from "remark-shiki-twoslash";
import devtools from "solid-devtools/vite";
import solid from "solid-start/vite";
// @ts-expect-error No types available yet.
import bun from "solid-start-bun";
import vercel from "solid-start-vercel";
import typescript, { type CompilerOptions } from "typescript";
import { defineConfig } from "vite";
const isVercel = process.env.VERCEL === "1";
export default defineConfig({
plugins: [
{
...mdx({
jsx: true,
jsxImportSource: "solid-js",
providerImportSource: "solid-mdx",
elementAttributeNameCase: "html",
stylePropertyNameCase: "css",
remarkPlugins: [
[
(remarkShikiTwoslash as any).default,
{
theme: "dark-plus",
addTryButton: true,
defaultCompilerOptions: {
target: typescript.ScriptTarget.ESNext,
} satisfies CompilerOptions,
},
],
// a11yEmoji,
remarkGfm,
remarkFrontmatter,
remarkMdxImages as any,
remarkMath,
],
rehypePlugins: [
[rehypeRaw, { passThrough: nodeTypes }],
rehypeSlug,
[rehypeExternalLinks, { target: "_blank", rel: ["noreferrer"] }],
rehypeKatex,
],
}),
enforce: "pre",
},
!isVercel &&
devtools({
autoname: true,
locator: {
targetIDE: "vscode",
componentLocation: true,
jsxLocation: true,
},
}),
solid({
extensions: [".mdx"],
adapter: isVercel ? vercel({ edge: true }) : bun(),
}),
],
});
// declare const test: import("typescript").CompilerOptions