File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import type { PluginWithDevTools } from '@vitejs/devtools-kit'
12import { addVitePlugin , defineNuxtModule } from '@nuxt/kit'
23import { DevToolsServer } from '../../../core/src/node/plugins/server'
34import { rpcFunctions } from '../node/rpc'
45
6+ // `@nuxt/kit` types `addVitePlugin` against whatever `vite` install pnpm
7+ // resolves for its own peer chain, which can differ from the one our
8+ // plugins are built against even on the same `vite` version — cast past
9+ // the resulting structural mismatch.
10+ function addDevToolsVitePlugin < T extends { name : string } > ( plugin : T ) : void {
11+ addVitePlugin ( plugin as unknown as Parameters < typeof addVitePlugin > [ 0 ] )
12+ }
13+
514export default defineNuxtModule ( {
615 meta : {
716 name : 'devtools-rpc' ,
817 configKey : 'devtoolsRpc' ,
918 } ,
1019 setup ( ) {
11- addVitePlugin ( {
20+ const rpcPlugin : PluginWithDevTools = {
1221 name : 'vite:devtools:oxc' ,
1322 devtools : {
1423 setup ( ctx ) {
@@ -17,8 +26,9 @@ export default defineNuxtModule({
1726 }
1827 } ,
1928 } ,
20- } )
29+ }
30+ addDevToolsVitePlugin ( rpcPlugin )
2131
22- addVitePlugin ( DevToolsServer ( ) )
32+ addDevToolsVitePlugin ( DevToolsServer ( ) )
2333 } ,
2434} )
Original file line number Diff line number Diff line change 1+ import type { PluginWithDevTools } from '@vitejs/devtools-kit'
12import { addVitePlugin , defineNuxtModule } from '@nuxt/kit'
23import { DevToolsServer } from '../../../core/src/node/plugins/server'
34import { rpcFunctions } from '../node/rpc'
45
6+ // `@nuxt/kit` types `addVitePlugin` against whatever `vite` install pnpm
7+ // resolves for its own peer chain, which can differ from the one our
8+ // plugins are built against even on the same `vite` version — cast past
9+ // the resulting structural mismatch.
10+ function addDevToolsVitePlugin < T extends { name : string } > ( plugin : T ) : void {
11+ addVitePlugin ( plugin as unknown as Parameters < typeof addVitePlugin > [ 0 ] )
12+ }
13+
514export default defineNuxtModule ( {
615 meta : {
716 name : 'devtools-rpc' ,
817 configKey : 'devtoolsRpc' ,
918 } ,
1019 setup ( ) {
11- addVitePlugin ( {
20+ const rpcPlugin : PluginWithDevTools = {
1221 name : 'vite:devtools:rolldown' ,
1322 devtools : {
1423 setup ( ctx ) {
@@ -17,8 +26,9 @@ export default defineNuxtModule({
1726 }
1827 } ,
1928 } ,
20- } )
29+ }
30+ addDevToolsVitePlugin ( rpcPlugin )
2131
22- addVitePlugin ( DevToolsServer ( ) )
32+ addDevToolsVitePlugin ( DevToolsServer ( ) )
2333 } ,
2434} )
Original file line number Diff line number Diff line change @@ -2,13 +2,21 @@ import { addVitePlugin, defineNuxtModule } from '@nuxt/kit'
22import { DevToolsServer } from '../../../core/src/node/plugins/server'
33import { DevToolsViteInspect } from '../node/inspect/plugin'
44
5+ // `@nuxt/kit` types `addVitePlugin` against whatever `vite` install pnpm
6+ // resolves for its own peer chain, which can differ from the one our
7+ // plugins are built against even on the same `vite` version — cast past
8+ // the resulting structural mismatch.
9+ function addDevToolsVitePlugin < T extends { name : string } > ( plugin : T ) : void {
10+ addVitePlugin ( plugin as unknown as Parameters < typeof addVitePlugin > [ 0 ] )
11+ }
12+
513export default defineNuxtModule ( {
614 meta : {
715 name : 'devtools-rpc' ,
816 configKey : 'devtoolsRpc' ,
917 } ,
1018 setup ( ) {
11- addVitePlugin ( DevToolsViteInspect ( ) )
12- addVitePlugin ( DevToolsServer ( ) )
19+ addDevToolsVitePlugin ( DevToolsViteInspect ( ) )
20+ addDevToolsVitePlugin ( DevToolsServer ( ) )
1321 } ,
1422} )
You can’t perform that action at this time.
0 commit comments