Skip to content

Commit bbe15df

Browse files
committed
feat: ssr support
1 parent 043827d commit bbe15df

18 files changed

+5087
-73
lines changed

README.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
## 📖 Introduction
1313

14-
A vite plugin which provides the ability that to jump to the local IDE when you click the element of browser automatically. It supports Vue2 & 3.
14+
A vite plugin which provides the ability that to jump to the local IDE when you click the element of browser automatically. It supports Vue2 & 3 & SSR.
1515

1616
<p align="center">
1717
<img src="https://github.com/webfansplz/vite-plugin-vue-inspector/blob/main/docs/images/vite-plugin-vue-inspector.gif" alt="vite-plugin-vue-inspector">
@@ -63,10 +63,56 @@ export default defineConfig({
6363
})
6464
```
6565

66+
```ts
67+
// for nuxt
68+
// nuxt.config.ts
69+
70+
import { defineNuxtConfig } from 'nuxt'
71+
import Inspector from "vite-plugin-vue-inspector"
72+
73+
export default defineNuxtConfig({
74+
vite: {
75+
plugins:[
76+
Inspector()
77+
]
78+
}
79+
})
80+
81+
```
82+
83+
### Nuxt Usage
84+
85+
```ts
86+
// App.vue
87+
88+
<template>
89+
<inspector-overlay v-if="isDev"/>
90+
</template>
91+
92+
<script lang="ts">
93+
94+
import InspectorOverlay from "vite-plugin-vue-inspector/overlay.vue"
95+
export default {
96+
name: "App",
97+
components: {
98+
InspectorOverlay
99+
},
100+
setup(){
101+
return {
102+
isDev: process.dev
103+
}
104+
}
105+
}
106+
107+
</script>
108+
```
109+
110+
66111
### Example
67112

68113
- [vue2](https://github.com/webfansplz/vite-plugin-vue-inspector/tree/main/example/vue2)
69114
- [vue3](https://github.com/webfansplz/vite-plugin-vue-inspector/tree/main/example/vue3)
115+
- [nuxt](https://github.com/webfansplz/vite-plugin-vue-inspector/tree/main/example/nuxt)
70116

71117
## 🔌 Configuration IDE / Editor
72118

@@ -120,7 +166,6 @@ export VUE_EDITOR=vim
120166

121167
## 💡 Notice
122168

123-
- It only work in develop mode .
124169
- It does not currently support `SSR` and `Template Engine (e.g. pug)` .
125170

126171
## 🌸 Thanks

example/nuxt/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
*.log*
3+
.nuxt
4+
.nitro
5+
.cache
6+
.output
7+
.env

example/nuxt/App.vue

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<template>
2+
<div class="container">
3+
<div>
4+
<Hi />
5+
<p> Welcome to here 🚀 . </p>
6+
<!-- -->
7+
<!-- -->
8+
<!-- -->
9+
<p>Vite so awesome 🔥 .</p>
10+
<a href="https://github.com/webfansplz/vite-plugin-vue-inspector">Give me a star if it helps you 💗 .</a>
11+
</div>
12+
</div>
13+
<inspector-overlay v-if="isDev" />
14+
</template>
15+
<script lang="ts">
16+
import Hi from "./Hi.vue"
17+
import InspectorOverlay from "vite-plugin-vue-inspector/overlay.vue"
18+
export default {
19+
name: "App",
20+
components: {
21+
Hi,
22+
InspectorOverlay,
23+
},
24+
setup() {
25+
return {
26+
isDev: process.dev,
27+
}
28+
},
29+
}
30+
</script>
31+
<style lang="sass" scoped>
32+
.container
33+
width: 100vw
34+
height: 100vh
35+
font-family: Avenir, Helvetica, Arial, sans-serif
36+
-webkit-font-smoothing: antialiased
37+
-moz-osx-font-smoothing: grayscale
38+
text-align: center
39+
display: flex
40+
align-items: center
41+
justify-content: center
42+
p
43+
font-size: 18px
44+
color: #35495d
45+
cursor: pointer
46+
</style>

example/nuxt/Hi.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template>
2+
<div>
3+
<h3>Hi</h3>
4+
</div>
5+
</template>
6+
<script lang="ts">
7+
import { defineComponent } from "vue"
8+
9+
export default defineComponent({
10+
name: "Hi",
11+
})
12+
</script>
13+
<style lang="sass" scoped>
14+
h3
15+
font-size: 26px
16+
color: #7390ff
17+
cursor: pointer
18+
</style>

example/nuxt/main.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { createApp } from "vue"
2+
import App from "./App.vue"
3+
createApp(App).mount("#app")

example/nuxt/nuxt.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineNuxtConfig } from "nuxt"
2+
import Inspector from "vite-plugin-vue-inspector"
3+
4+
export default defineNuxtConfig({
5+
vite: {
6+
plugins: [
7+
Inspector(),
8+
],
9+
},
10+
})

example/nuxt/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"build": "nuxt build",
5+
"dev": "nuxt dev",
6+
"generate": "nuxt generate",
7+
"preview": "nuxt preview"
8+
},
9+
"devDependencies": {
10+
"nuxt": "3.0.0-rc.1",
11+
"vite-plugin-vue-inspector": "0.5.3"
12+
}
13+
}

0 commit comments

Comments
 (0)