mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
feat(vite): check types with vue-tsc
(#6012)
This commit is contained in:
parent
eff6b0c4ca
commit
edbe4fe799
@ -4,7 +4,7 @@ Nuxt 3 is fully typed and provides helpful shortcuts to ensure you have access t
|
||||
|
||||
## Type-checking
|
||||
|
||||
By default, Nuxt doesn't check types when you run `nuxi dev` or `nuxi build`, for performance reasons. However, you can enable type-checking at build or development time with [the `typescript.typeCheck` option in your `nuxt.config` file](/api/configuration/nuxt.config#typescript), or [manually check your types with nuxi](/api/commands/typecheck).
|
||||
By default, Nuxt doesn't check types when you run `nuxi dev` or `nuxi build`, for performance reasons. However, you can enable type-checking at build or development time by installing `vue-tsc` and `typescript` as devDependencies and either enabling [the `typescript.typeCheck` option in your `nuxt.config` file](/api/configuration/nuxt.config#typescript) or [manually checking your types with nuxi](/api/commands/typecheck).
|
||||
|
||||
```bash
|
||||
yarn nuxi typecheck
|
||||
|
@ -13,5 +13,5 @@ Option | Default | Description
|
||||
This command sets `process.env.NODE_ENV` to `production`. To override, define `NODE_ENV` in a `.env` file or as a command-line argument.
|
||||
|
||||
::alert
|
||||
You can also enable type-checking at build or development time with [the `typescript.typeCheck` option in your `nuxt.config` file](/api/configuration/nuxt.config#typescript).
|
||||
You can also enable type-checking at build or development time by installing `vue-tsc` and `typescript` as devDependencies and enabling [the `typescript.typeCheck` option in your `nuxt.config` file](/api/configuration/nuxt.config#typescript).
|
||||
::
|
||||
|
@ -90,7 +90,7 @@ export async function buildServer (ctx: ViteBuildContext) {
|
||||
// Add type-checking
|
||||
if (ctx.nuxt.options.typescript.typeCheck === true || (ctx.nuxt.options.typescript.typeCheck === 'build' && !ctx.nuxt.options.dev)) {
|
||||
const checker = await import('vite-plugin-checker').then(r => r.default)
|
||||
serverConfig.plugins.push(checker({ typescript: true }))
|
||||
serverConfig.plugins.push(checker({ vueTsc: true }))
|
||||
}
|
||||
|
||||
await ctx.nuxt.callHook('vite:extendConfig', serverConfig, { isClient: false, isServer: true })
|
||||
|
Loading…
Reference in New Issue
Block a user