Skip to content

Commit a87f7c8

Browse files
authored
chore: vite quick start
1 parent af89096 commit a87f7c8

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

content/configuration/vite.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,43 @@ Install the plugin.
1515
npm install @nativescript/vite
1616
```
1717

18+
## Quick start (`init`)
19+
20+
To bootstrap an existing NativeScript app for Vite, run from your app root:
21+
22+
```bash
23+
npx nativescript-vite init
24+
```
25+
26+
This will:
27+
28+
- Generate a `vite.config.ts` using the detected project flavor (Angular, Vue, React, Solid, TypeScript, or JavaScript) and the corresponding helper from `@nativescript/vite`.
29+
- Add (or update) the following npm scripts in your app `package.json`:
30+
- `dev:ios`
31+
- `dev:android`
32+
- `dev:server:ios`
33+
- `dev:server:android`
34+
- `ios`
35+
- `android`
36+
- Add the devDependencies `concurrently` and `wait-on`.
37+
- Add the dependency `@valor/nativescript-websockets`.
38+
- Append `.ns-vite-build` to `.gitignore` if it is not already present.
39+
40+
After running `init`, you now have two ways to work with Vite:
41+
42+
1. HMR workflow
43+
44+
```bash
45+
npm run dev:ios
46+
```
47+
48+
2. Standard dev workflow (non-HMR)
49+
50+
```bash
51+
ns debug ios --no-hmr
52+
ns debug android --no-hmr
53+
```
54+
1855
## Configure
1956

2057
The plugin comes with several framework integrations.

0 commit comments

Comments
 (0)