create-lve 0.4.32 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -55,7 +55,7 @@ async function main() {
55
55
  shouldOverwrite = await p.confirm({ message: `目录已存在,是否清空?`, initialValue: false })
56
56
  if (p.isCancel(shouldOverwrite)) onCancel()
57
57
  }
58
- project = { path: name, framework: 'vue', cssEngine: 'unocss', shouldOverwrite }
58
+ project = { path: name, framework: 'react', cssEngine: 'tailwind', shouldOverwrite }
59
59
  } else {
60
60
  // 交互模式
61
61
  project = await p.group(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-lve",
3
- "version": "0.4.32",
3
+ "version": "0.5.1",
4
4
  "bin": {
5
5
  "create-lve": "index.js"
6
6
  },
@@ -19,7 +19,6 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "@babel/core": "latest",
22
- "@rolldown/plugin-babel": "latest",
23
22
  "@tailwindcss/vite": "latest",
24
23
  "@types/babel__core": "latest",
25
24
  "@types/node": "latest",
@@ -27,6 +26,7 @@
27
26
  "@types/react-dom": "latest",
28
27
  "@vitejs/plugin-react": "latest",
29
28
  "babel-plugin-react-compiler": "latest",
29
+ "oxc-transform": "latest",
30
30
  "tailwindcss": "latest",
31
31
  "typescript": "latest",
32
32
  "vite": "latest",
@@ -1,8 +1,10 @@
1
1
  import { defineConfig, loadEnv, lazyPlugins } from 'vite-plus'
2
- import react, { reactCompilerPreset } from '@vitejs/plugin-react'
2
+ import react from '@vitejs/plugin-react'
3
3
 
4
4
  const mode = process.env.NODE_ENV || 'development'
5
5
  const env = loadEnv(mode, process.cwd(), '')
6
+ // React Compiler: true = OXC (Rust native, experimental), false = Babel (official, stable)
7
+ const USE_OXC = true
6
8
 
7
9
  // https://vite.dev/config/
8
10
  export default defineConfig({
@@ -15,12 +17,31 @@ export default defineConfig({
15
17
  /* VITE_PLUS_PLUGINS */
16
18
  react(),
17
19
  lazyPlugins(async () => {
18
- const { default: babel } = await import('@rolldown/plugin-babel')
19
- return [
20
- babel({
21
- presets: [reactCompilerPreset()],
22
- }),
23
- ]
20
+ if (USE_OXC) {
21
+ const { transform } = await import('oxc-transform')
22
+ return [
23
+ {
24
+ name: 'oxc-react-compiler',
25
+ enforce: 'pre',
26
+ transform(code, id) {
27
+ if (!/\.[tj]sx$/.test(id)) return
28
+ const result = transform(id, code, {
29
+ jsx: { runtime: 'automatic' },
30
+ reactCompiler: { target: '19' },
31
+ })
32
+ return { code: result.code, map: result.map }
33
+ },
34
+ },
35
+ ]
36
+ } else {
37
+ const { reactCompilerPreset } = await import('@vitejs/plugin-react')
38
+ const { default: babel } = await import('@rolldown/plugin-babel')
39
+ return [
40
+ babel({
41
+ presets: [reactCompilerPreset()],
42
+ }),
43
+ ]
44
+ }
24
45
  }),
25
46
  ],
26
47
  resolve: {
@@ -34,8 +55,7 @@ export default defineConfig({
34
55
  const pkg = id.match(/node_modules\/(?:@[^/]+\/)?([^/]+)/)?.[1]
35
56
  if (pkg === 'react') return 'vendor-react'
36
57
  if (pkg === 'react-dom') return 'vendor-react-dom'
37
- if (pkg === 'react-router' || pkg === 'react-router-dom')
38
- return 'vendor-router'
58
+ if (pkg === 'react-router') return 'vendor-router'
39
59
  if (id.includes('@tanstack')) return 'vendor-query'
40
60
  if (pkg === 'zustand') return 'vendor-state'
41
61
  if (pkg === 'jotai') return 'vendor-atom'