From edbe4fe7998377750e7e4beb77fa5c326630309f Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 20 Jul 2022 16:15:27 +0100 Subject: [PATCH] feat(vite): check types with `vue-tsc` (#6012) --- docs/content/2.guide/1.concepts/6.typescript.md | 2 +- docs/content/3.api/5.commands/typecheck.md | 2 +- packages/vite/src/server.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/2.guide/1.concepts/6.typescript.md b/docs/content/2.guide/1.concepts/6.typescript.md index 6d3a44b155..af07032e22 100644 --- a/docs/content/2.guide/1.concepts/6.typescript.md +++ b/docs/content/2.guide/1.concepts/6.typescript.md @@ -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 diff --git a/docs/content/3.api/5.commands/typecheck.md b/docs/content/3.api/5.commands/typecheck.md index 91af20d57e..23d5a0a1e7 100644 --- a/docs/content/3.api/5.commands/typecheck.md +++ b/docs/content/3.api/5.commands/typecheck.md @@ -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). :: diff --git a/packages/vite/src/server.ts b/packages/vite/src/server.ts index dd7ea32aa8..13833bd5c9 100644 --- a/packages/vite/src/server.ts +++ b/packages/vite/src/server.ts @@ -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 })