-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
/
Copy pathcli.md
126 lines (99 loc) · 7.92 KB
/
cli.md
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Command Line Interface
## Dev server
### `vite`
Start Vite dev server in the current directory. Will enter the watch mode in development environment and run mode in CI automatically.
#### Usage
```bash
vite [root]
```
#### Options
| Options | |
| ------------------------ | ----------------------------------------------------------------- |
| `--host [host]` | Specify hostname (`string`) |
| `--port <port>` | Specify port (`number`) |
| `--https` | Use TLS + HTTP/2 (`boolean`) |
| `--open [path]` | Open browser on startup (`boolean \| string`) |
| `--cors` | Enable CORS (`boolean`) |
| `--strictPort` | Exit if specified port is already in use (`boolean`) |
| `--force` | Force the optimizer to ignore the cache and re-bundle (`boolean`) |
| `-c, --config <file>` | Use specified config file (`string`) |
| `--base <path>` | Public base path (default: `/`) (`string`) |
| `-l, --logLevel <level>` | Info \| warn \| error \| silent (`string`) |
| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) |
| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) |
| `-f, --filter <filter>` | Filter debug logs (`string`) |
| `-m, --mode <mode>` | Set env mode (`string`) |
| `-h, --help` | Display available CLI options |
| `-v, --version` | Display version number |
## Build
### `vite build`
Build for production.
#### Usage
```bash
vite build [root]
```
#### Options
| Options | |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
| `--target <target>` | Transpile target (default: `"modules"`) (`string`) |
| `--outDir <dir>` | Output directory (default: `dist`) (`string`) |
| `--assetsDir <dir>` | Directory under outDir to place assets in (default: `"assets"`) (`string`) |
| `--assetsInlineLimit <number>` | Static asset base64 inline threshold in bytes (default: `4096`) (`number`) |
| `--ssr [entry]` | Build specified entry for server-side rendering (`string`) |
| `--sourcemap` | Output source maps for build (default: `false`) (`boolean`) |
| `--minify [minifier]` | Enable/disable minification, or specify minifier to use (default: `"esbuild"`) (`boolean \| "terser" \| "esbuild"`) |
| `--manifest [name]` | Emit build manifest json (`boolean \| string`) |
| `--ssrManifest [name]` | Emit ssr manifest json (`boolean \| string`) |
| `--force` | Force the optimizer to ignore the cache and re-bundle (experimental)(`boolean`) |
| `--emptyOutDir` | Force empty outDir when it's outside of root (`boolean`) |
| `-w, --watch` | Rebuilds when modules have changed on disk (`boolean`) |
| `-c, --config <file>` | Use specified config file (`string`) |
| `--base <path>` | Public base path (default: `/`) (`string`) |
| `-l, --logLevel <level>` | Info \| warn \| error \| silent (`string`) |
| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) |
| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) |
| `-f, --filter <filter>` | Filter debug logs (`string`) |
| `-m, --mode <mode>` | Set env mode (`string`) |
| `-h, --help` | Display available CLI options |
## Others
### `vite optimize`
Pre-bundle dependencies.
#### Usage
```bash
vite optimize [root]
```
#### Options
| Options | |
| ------------------------ | ----------------------------------------------------------------- |
| `--force` | Force the optimizer to ignore the cache and re-bundle (`boolean`) |
| `-c, --config <file>` | Use specified config file (`string`) |
| `--base <path>` | Public base path (default: `/`) (`string`) |
| `-l, --logLevel <level>` | Info \| warn \| error \| silent (`string`) |
| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) |
| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) |
| `-f, --filter <filter>` | Filter debug logs (`string`) |
| `-m, --mode <mode>` | Set env mode (`string`) |
| `-h, --help` | Display available CLI options |
### `vite preview`
Locally preview production build.
#### Usage
```bash
vite preview [root]
```
#### Options
| Options | |
| ------------------------ | ---------------------------------------------------- |
| `--host [host]` | Specify hostname (`string`) |
| `--port <port>` | Specify port (`number`) |
| `--strictPort` | Exit if specified port is already in use (`boolean`) |
| `--https` | Use TLS + HTTP/2 (`boolean`) |
| `--open [path]` | Open browser on startup (`boolean \| string`) |
| `--outDir <dir>` | Output directory (default: `dist`)(`string`) |
| `-c, --config <file>` | Use specified config file (`string`) |
| `--base <path>` | Public base path (default: `/`) (`string`) |
| `-l, --logLevel <level>` | Info \| warn \| error \| silent (`string`) |
| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) |
| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) |
| `-f, --filter <filter>` | Filter debug logs (`string`) |
| `-m, --mode <mode>` | Set env mode (`string`) |
| `-h, --help` | Display available CLI options |