mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-16 19:04:48 +00:00
b5618e976b
Co-authored-by: pooya parsa <pyapar@gmail.com>
94 lines
2.1 KiB
Markdown
94 lines
2.1 KiB
Markdown
# Commands
|
|
|
|
Nuxi is the new CLI experience for Nuxt 3
|
|
|
|
Nuxt 3 has two main commands, one to start the development server and one to make production assets.
|
|
|
|
Since Nuxt 3 becomes a dev dependency thanks to the new [Nitro server](/concepts/server-engine), you only need to add two commands in your `package.json`:
|
|
|
|
```json [package.json]
|
|
"scripts": {
|
|
"dev": "nuxi dev",
|
|
"build": "nuxi build",
|
|
}
|
|
```
|
|
|
|
Then, you can run each command using `npm run <command>` or `yarn <command>`.
|
|
|
|
## Development Server
|
|
|
|
To start Nuxt in development mode with hot module replacement on <http://localhost:3000>:
|
|
|
|
::code-group
|
|
|
|
```bash [Yarn]
|
|
yarn dev
|
|
```
|
|
|
|
```bash [NPM]
|
|
npm run dev
|
|
```
|
|
|
|
::
|
|
|
|
To start Nuxt in development mode with HTTPS <https://localhost:3000> (self-signed certificate):
|
|
|
|
::code-group
|
|
|
|
```bash [Yarn]
|
|
yarn dev --https
|
|
```
|
|
|
|
```bash [NPM]
|
|
npm run dev -- --https
|
|
```
|
|
|
|
::
|
|
::alert
|
|
`options.server` from `nuxt.config` is not supported. You can use `--port`, `--host`, `--https`, `--ssl-cert` and `--ssl-key` instead.
|
|
::
|
|
|
|
## Building for production
|
|
|
|
To build your Nuxt application for production, run:
|
|
|
|
::code-group
|
|
|
|
```bash [Yarn]
|
|
yarn build
|
|
```
|
|
|
|
```bash [NPM]
|
|
npm run build
|
|
```
|
|
|
|
::
|
|
|
|
Nuxt will create a [`.output`](/docs/directory-structure/output) directory with all your application, server and dependencies ready to be deployed. Check out the [deployment](/docs/deployment) section to learn where and how you can deploy a Nuxt application using Nitro.
|
|
|
|
## Previewing your production build
|
|
|
|
Once you've built your Nuxt application, you can preview it locally:
|
|
|
|
```bash
|
|
npx nuxi preview
|
|
```
|
|
|
|
If you're using a supported preset, this will start a local server (for testing purposes only).
|
|
|
|
## Upgrade Nuxt3 version
|
|
|
|
To upgrade Nuxt3 version:
|
|
|
|
```bash
|
|
npx nuxi upgrade
|
|
```
|
|
|
|
## Checking types
|
|
|
|
To type-check your application, you can use `nuxi typecheck`. This uses [`vue-tsc`](https://github.com/johnsoncodehk/volar/tree/master/packages/vue-tsc) under the hood. If you have both a locally installed version of `typescript` and `vue-tsc`, nuxi will use these when type-checking.
|
|
|
|
```bash
|
|
npx nuxi typecheck
|
|
```
|