Skip to content

Commit

Permalink
使项目支持 React
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhang-Wei-666 committed Feb 17, 2025
1 parent 35d3f04 commit 860e714
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 11 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@
"@types/js-yaml": "^4.0.9",
"@types/lodash-es": "^4.17.12",
"@types/postcss-js": "^4.0.4",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"@types/three": "catalog:",
"@vercel/analytics": "^1.4.1",
"@vitejs/plugin-react": "^4.3.4",
"@vitejs/plugin-vue": "^5.2.1",
"@vitejs/plugin-vue-jsx": "^4.1.1",
"@vitest/coverage-v8": "^3.0.5",
Expand Down Expand Up @@ -103,6 +106,8 @@
"postcss": "^8.5.1",
"postcss-js": "^4.0.1",
"radash": "^12.1.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"rollup": "^4.34.6",
"rollup-plugin-dts": "^6.1.1",
"sass": "^1.84.0",
Expand All @@ -120,6 +125,7 @@
"unplugin-auto-import": "^19.0.0",
"unplugin-icons": "^22.0.0",
"unplugin-vue-components": "^28.0.0",
"veaury": "^2.6.2",
"vite": "^6.1.0",
"vitepress": "^1.6.3",
"vitest": "^3.0.5",
Expand Down
18 changes: 17 additions & 1 deletion packages/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { fileURLToPath } from 'node:url';
import { transformerTwoslash } from '@shikijs/vitepress-twoslash';
import { createFileSystemTypesCache } from '@shikijs/vitepress-twoslash/cache-fs';
import React from '@vitejs/plugin-react';
import VueJsx from '@vitejs/plugin-vue-jsx';
import { dirname, resolve } from 'pathe';
import { pascalCase } from 'scule';
Expand Down Expand Up @@ -151,7 +152,22 @@ export default defineConfig({
],
},
plugins: [
VueJsx(),
{
...VueJsx({
exclude: [/[/\\]components-react[\\/$]+/],
}),
enforce: 'pre',
},
React({
jsxImportSource: 'react',
}),
{
config: () => ({
esbuild: {
include: /\.[jt]sx?$/,
},
}),
},
MarkdownTransform(),
Unocss({
configFile: resolve(__dirname, '../unocss.config.ts'),
Expand Down
Loading

0 comments on commit 860e714

Please sign in to comment.