Command | Description |
---|---|
vite |
Start dev server with HMR, aliases: vite dev , vite serve . |
vite build |
Build for production, files are output to ./dist . |
vite preview |
Locally preview production build, start a local web server serving built app from ./dist . |
Dev server runs dev
(default) in development
mode and runs build
in production
mode, which means dev
reads variables from .env.dev
and build
reads variables from .env.production
.
Example:
1 | VITE_APP_TITLE=My App |
In the app, render title with import.meta.env.VITE_APP_TITLE
.
When running vite from the command line, Vite will automatically try to resolve a config file named vite.config.js
inside project root.
1 | // vite.config.js |
If config needs to conditionally determine options based on the mode, or if it is an SSR build (ssrBuild), export a function instead:
1 | export default defineConfig( ({command, mode, ssrBuild}) => { |
Just a javascript file which can import functionality from other and export its own functionality.
The industry-standard protocol for authorization.
This specification and its extensions are being developed within the IETF OAuth Working Group.