create-vite-taro 0.2.2 → 0.3.0
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/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# create-vite-taro
|
|
2
2
|
|
|
3
|
-
Create a Vite 8 + React 19 + Taro app for WeChat Mini Program and H5 targets.
|
|
3
|
+
Create a Vite 8 + React 19 + Taro app for WeChat Mini Program and Web/H5 targets.
|
|
4
4
|
|
|
5
5
|
## Quick start
|
|
6
6
|
|
|
@@ -8,14 +8,17 @@ Create a Vite 8 + React 19 + Taro app for WeChat Mini Program and H5 targets.
|
|
|
8
8
|
# Create a new app from the default template
|
|
9
9
|
npm create vite-taro@latest my-app
|
|
10
10
|
|
|
11
|
+
# Or create with pnpm
|
|
12
|
+
pnpm --config.minimum-release-age=0 create vite-taro@latest my-app
|
|
13
|
+
|
|
11
14
|
# Enter the project and install dependencies
|
|
12
15
|
cd my-app
|
|
13
16
|
npm install
|
|
14
17
|
|
|
15
|
-
# WeChat Mini Program:
|
|
18
|
+
# WeChat Mini Program: start Vite with hot reload
|
|
16
19
|
npm run dev:wx
|
|
17
20
|
|
|
18
|
-
# H5: start the Vite dev server
|
|
21
|
+
# Web/H5: start the Vite dev server
|
|
19
22
|
npm run dev:h5
|
|
20
23
|
|
|
21
24
|
# Then open the standard Vite dev URL in your browser
|
|
@@ -24,14 +27,16 @@ npm run dev:h5
|
|
|
24
27
|
|
|
25
28
|
You can keep `npm run dev:wx` and `npm run dev:h5` running at the same time in separate terminals.
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
WeChat development fully supports Vite-powered hot reload. JavaScript edits preserve the active native page and React/input state, while other changes are rebuilt automatically.
|
|
28
31
|
|
|
29
32
|
Set `VITE_PLUGIN_TARO_WECHAT_APP_ID` in the generated `.env.local` to your WeChat Mini Program App ID, then open `dist/wx` with WeChat DevTools for Mini Program development.
|
|
30
33
|
|
|
34
|
+
The generated app keeps global styles in `src/app.css` and includes Tailwind CSS v4 plus Taro component styles out of the box.
|
|
35
|
+
|
|
31
36
|
## Other package managers
|
|
32
37
|
|
|
33
38
|
```sh
|
|
34
|
-
pnpm create vite-taro my-app
|
|
39
|
+
pnpm --config.minimum-release-age=0 create vite-taro@latest my-app
|
|
35
40
|
yarn create vite-taro my-app
|
|
36
41
|
bun create vite-taro my-app
|
|
37
42
|
```
|
|
@@ -40,11 +45,11 @@ bun create vite-taro my-app
|
|
|
40
45
|
|
|
41
46
|
| Command | Description |
|
|
42
47
|
| --- | --- |
|
|
43
|
-
| `npm run dev:wx` |
|
|
44
|
-
| `npm run dev:h5` | Start the H5 dev server
|
|
48
|
+
| `npm run dev:wx` | Start WeChat Mini Program development with hot reload. |
|
|
49
|
+
| `npm run dev:h5` | Start the Web/H5 dev server. |
|
|
45
50
|
| `npm run build:wx` | Build the WeChat Mini Program output into `dist/wx`. |
|
|
46
|
-
| `npm run build:h5` | Build the H5 output into `dist/h5`. |
|
|
47
|
-
| `npm run preview:h5` | Preview the built H5 output. |
|
|
51
|
+
| `npm run build:h5` | Build the Web/H5 output into `dist/h5`. |
|
|
52
|
+
| `npm run preview:h5` | Preview the built Web/H5 output. |
|
|
48
53
|
| `npm run typecheck` | Typecheck with `tsc`. |
|
|
49
54
|
|
|
50
55
|
## Troubleshooting
|
package/package.json
CHANGED
|
@@ -10,10 +10,10 @@ Docs and source: <https://github.com/sep2/vite-plugin-taro>
|
|
|
10
10
|
# Install dependencies after scaffolding
|
|
11
11
|
npm install
|
|
12
12
|
|
|
13
|
-
# WeChat Mini Program:
|
|
13
|
+
# WeChat Mini Program: start Vite with native hot reload
|
|
14
14
|
npm run dev:wx
|
|
15
15
|
|
|
16
|
-
# H5: start the Vite dev server
|
|
16
|
+
# Web/H5: start the Vite dev server
|
|
17
17
|
npm run dev:h5
|
|
18
18
|
|
|
19
19
|
# Then open the standard Vite dev URL in your browser
|
|
@@ -22,15 +22,17 @@ npm run dev:h5
|
|
|
22
22
|
|
|
23
23
|
You can keep `npm run dev:wx` and `npm run dev:h5` running at the same time in separate terminals.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Set `VITE_PLUGIN_TARO_WECHAT_APP_ID` in `.env.local` to your WeChat App ID, then open `dist/wx` with WeChat DevTools for Mini Program development. The generated project enables hot reload and disables Skyline rendering and URL checks by default.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## Styles
|
|
28
|
+
|
|
29
|
+
Global styles live in `src/app.css`. Keep the Tailwind subpath imports and `@source "./";` line so Tailwind CSS v4 works for both targets. Taro H5 component styles are injected by the plugin.
|
|
28
30
|
|
|
29
31
|
## Scripts
|
|
30
32
|
|
|
31
33
|
```sh
|
|
32
|
-
npm run dev:wx #
|
|
33
|
-
npm run dev:h5 # Start the H5 dev server
|
|
34
|
+
npm run dev:wx # Start WeChat Mini Program development with hot reload
|
|
35
|
+
npm run dev:h5 # Start the Web/H5 dev server
|
|
34
36
|
npm run build:wx # Build dist/wx
|
|
35
37
|
npm run build:h5 # Build dist/h5
|
|
36
38
|
npm run preview:h5 # Preview dist/h5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VITE_PLUGIN_TARO_WECHAT_APP_ID=wx0000000000000000
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"version": "0.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"dev:wx": "cross-env NODE_ENV=development VITE_PLUGIN_TARO_TARGET=wx vite
|
|
7
|
+
"dev:wx": "cross-env NODE_ENV=development VITE_PLUGIN_TARO_TARGET=wx vite",
|
|
8
8
|
"dev:h5": "cross-env NODE_ENV=development VITE_PLUGIN_TARO_TARGET=h5 vite",
|
|
9
9
|
"build:wx": "cross-env NODE_ENV=production VITE_PLUGIN_TARO_TARGET=wx vite build",
|
|
10
10
|
"build:h5": "cross-env NODE_ENV=production VITE_PLUGIN_TARO_TARGET=h5 vite build",
|
|
@@ -16,13 +16,12 @@
|
|
|
16
16
|
"react-dom": "^19.2.7"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/node": "^26.
|
|
19
|
+
"@types/node": "^26.1.1",
|
|
20
20
|
"@types/react": "^19.2.17",
|
|
21
21
|
"@types/react-dom": "^19.2.3",
|
|
22
|
-
"typescript": "^7.0.
|
|
22
|
+
"typescript": "^7.0.2",
|
|
23
23
|
"cross-env": "^10.1.0",
|
|
24
|
-
"
|
|
25
|
-
"vite": "^
|
|
26
|
-
"vite-plugin-taro": "^0.2.2"
|
|
24
|
+
"vite": "^8.1.4",
|
|
25
|
+
"vite-plugin-taro": "^0.3.0"
|
|
27
26
|
}
|
|
28
27
|
}
|
|
@@ -57,11 +57,13 @@ export default defineConfig(({ mode }) => {
|
|
|
57
57
|
description: '',
|
|
58
58
|
compileType: 'miniprogram',
|
|
59
59
|
setting: {
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
// WeChat DevTools does not support hot reload with Skyline yet.
|
|
61
|
+
skylineRenderEnable: false,
|
|
62
|
+
urlCheck: false,
|
|
62
63
|
es6: false,
|
|
63
64
|
postcss: false,
|
|
64
65
|
minified: false,
|
|
66
|
+
compileHotReLoad: true,
|
|
65
67
|
enhance: false,
|
|
66
68
|
uglifyFileName: false,
|
|
67
69
|
preloadBackgroundData: false,
|
|
@@ -73,6 +75,11 @@ export default defineConfig(({ mode }) => {
|
|
|
73
75
|
useCompilerModule: false
|
|
74
76
|
}
|
|
75
77
|
},
|
|
78
|
+
projectPrivateConfigJson: {
|
|
79
|
+
setting: {
|
|
80
|
+
urlCheck: false
|
|
81
|
+
}
|
|
82
|
+
},
|
|
76
83
|
sitemapJson: {
|
|
77
84
|
rules: [{ action: 'allow', page: '*' }]
|
|
78
85
|
}
|