Vite
Initialization
npm create vite@latest <project-name> -- --template <template-option>
Template options:
vanilla
,vanilla-ts
vue
,vue-ts
react
,react-ts
svelte
,svelte-ts
solid
,solid-ts
qwik
,qwik-ts
More at Getting Started (vitejs.dev).
Usage
vite <command> [option]
# Use with npm scripts
npm run dev
npm run build
npm run preview
// package.json e.g.:
{
"scripts": {
"dev": "vite --port <port-number> --open --host",
"build": "tsc && vite build",
"preview": "vite preview --port <port-number> --open --host"
}
}
Commands:
dev
(default command, can be omitted), options:--host <host-name>
--port <port-number>
--https
--open
--cors
--strictPort
(exit if port number is already in use)
build
, options:--outDir <dir>
(dist
by default)--minify <boolean|minifier
(minifiers:esbuild
,terser
)--ssr <entry>
(build a given entry SSR)
preview
(most options are shared withdev
)
More at Command Line Interface (vitejs.dev).