Skip to content

Commit 7eb4c84

Browse files
committed
docs: add how to use with Nuxt
1 parent a8a11f9 commit 7eb4c84

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

docs/faq/integration.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## with traditional backend
44

5-
### Hot Module Refresh does not work when integrating with backend
5+
### overlay does not display in development mode
66

77
When integrating with a [traditional backend](https://vitejs.dev/guide/backend-integration.html#backend-integration), in development mode, you need to inject vite-plugin-checker's runtime manually.
88

@@ -13,3 +13,46 @@ When integrating with a [traditional backend](https://vitejs.dev/guide/backend-i
1313
<!-- add below for vite-plugin-checker -->
1414
<script type="module" src="http://localhost:5173/@vite-plugin-checker-runtime-entry"></script>
1515
```
16+
17+
## with Nuxt3
18+
19+
### overlay does not display in development mode
20+
21+
There're two ways to use vite-plugin-checker with Nuxt3 for now.
22+
23+
#### Use vite-plugin-checker as a normal Vite plugin
24+
25+
There are a few steps to do:
26+
27+
1. Add `vite-plugin-checker` `typescript` `vue-tsc` `@types/node` as devDependencies to your Nuxt project.
28+
2. Create a Vue component with content:
29+
```vue
30+
// vite-plugin-checker.vue
31+
<script setup>
32+
import('/@vite-plugin-checker-runtime-entry')
33+
</script>
34+
```
35+
3. Import component above in the root component of your Nuxt project to have a global error overlay.
36+
37+
```vue
38+
<script setup lang="ts">
39+
import Vpc from './vite-plugin-checker.vue'
40+
</script>
41+
42+
<template>
43+
<!-- your app code -->
44+
<DevOnly>
45+
<ClientOnly>
46+
<Vpc />
47+
</ClientOnly>
48+
</DevOnly>
49+
</template>
50+
```
51+
52+
#### Enable vite-plugin-checker as a built-in Nuxt functionality
53+
54+
::: warning
55+
The error overlay can not be displayed in this way, we'll try to fix this with Nuxt in the future.
56+
:::
57+
58+
See Nuxt's official documentation's [typecheck section](https://nuxt.com/docs/api/commands/typecheck#nuxi-typecheck).

0 commit comments

Comments
 (0)