-
-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathrpc.ts
More file actions
30 lines (26 loc) · 741 Bytes
/
rpc.ts
File metadata and controls
30 lines (26 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { addVitePlugin, createResolver, defineNuxtModule } from '@nuxt/kit'
import { DevToolsServer } from '../../../core/src/node/plugins/server'
import { rpcFunctions } from '../node/rpc'
export default defineNuxtModule({
meta: {
name: 'devtools-rpc',
configKey: 'devtoolsRpc',
},
setup(options, nuxt) {
const resolver = createResolver(import.meta.url)
addVitePlugin({
name: 'vite:devtools:rolldown',
devtools: {
setup(ctx) {
for (const fn of rpcFunctions) {
ctx.rpc.register(fn)
}
},
},
})
addVitePlugin(DevToolsServer())
nuxt.hook('imports:dirs', (dirs) => {
dirs.push(resolver.resolve('./runtime/composables'))
})
},
})