Skip to content

Commit

Permalink
fix(schema): disable typescript.shim in favour of volar (#26052)
Browse files Browse the repository at this point in the history
  • Loading branch information
oumarbarry committed Mar 5, 2024
1 parent 375bd64 commit 280d30d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
13 changes: 1 addition & 12 deletions docs/1.getting-started/2.installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,14 @@ Start with one of our starters and themes directly by opening [nuxt.new](https:/
#### Prerequisites

- **Node.js** - [`v18.0.0`](https://nodejs.org/en) or newer
- **Text editor** - We recommend [Visual Studio Code](https://code.visualstudio.com/) with the [Volar Extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
- **Text editor** - We recommend [Visual Studio Code](https://code.visualstudio.com/) with the [official Vue extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (previously known as Volar)
- **Terminal** - In order to run Nuxt commands

::note
::details
:summary[Additional notes for an optimal setup:]
- **Node.js**: Make sure to use an even numbered version (18, 20, etc)
- **Nuxtr**: Install the community-developed [Nuxtr extension](https://marketplace.visualstudio.com/items?itemName=Nuxtr.nuxtr-vscode)
- **Volar**: Either enable [**Take Over Mode**](https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode) (recommended) or add the [TypeScript Vue Plugin](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin)

If you have enabled **Take Over Mode** or installed the **TypeScript Vue Plugin (Volar)**, you can disable generating the shim for `*.vue` files in your [`nuxt.config.ts`](/docs/guide/directory-structure/nuxt-config) file:

```ts twoslash [nuxt.config.ts]
export default defineNuxtConfig({
typescript: {
shim: false
}
})
```
::
::

Expand Down
1 change: 1 addition & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { addPluginTemplate } from 'nuxt/kit'

export default defineNuxtConfig({
typescript: { shim: process.env.DOCS_TYPECHECK === 'true' },
pages: process.env.DOCS_TYPECHECK === 'true',
modules: [
function () {
Expand Down
6 changes: 3 additions & 3 deletions packages/schema/src/config/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export default defineUntypedSchema({
/**
* Generate a `*.vue` shim.
*
* We recommend instead either enabling [**Take Over Mode**](https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode) or adding
* TypeScript Vue Plugin (Volar)** 👉 [[Download](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin)].
* We recommend instead letting the [official Vue extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
* generate accurate types for your components.
*/
shim: true
shim: false
}
})

0 comments on commit 280d30d

Please sign in to comment.