@@ -13,35 +13,38 @@ import { extractSourceMap } from './source-map'
1313const debugExecute = createDebug ( 'vite-node:client:execute' )
1414const debugNative = createDebug ( 'vite-node:client:native' )
1515
16- export const DEFAULT_REQUEST_STUBS = {
17- '/@vite/client' : {
18- injectQuery : ( id : string ) => id ,
19- createHotContext ( ) {
20- return {
21- accept : ( ) => { } ,
22- prune : ( ) => { } ,
23- dispose : ( ) => { } ,
24- decline : ( ) => { } ,
25- invalidate : ( ) => { } ,
26- on : ( ) => { } ,
27- }
28- } ,
29- updateStyle ( id : string , css : string ) {
30- if ( typeof document === 'undefined' )
31- return
32-
33- const element = document . getElementById ( id )
34- if ( element )
35- element . remove ( )
36-
37- const head = document . querySelector ( 'head' )
38- const style = document . createElement ( 'style' )
39- style . setAttribute ( 'type' , 'text/css' )
40- style . id = id
41- style . innerHTML = css
42- head ?. appendChild ( style )
43- } ,
16+ const clientStub = {
17+ injectQuery : ( id : string ) => id ,
18+ createHotContext ( ) {
19+ return {
20+ accept : ( ) => { } ,
21+ prune : ( ) => { } ,
22+ dispose : ( ) => { } ,
23+ decline : ( ) => { } ,
24+ invalidate : ( ) => { } ,
25+ on : ( ) => { } ,
26+ }
4427 } ,
28+ updateStyle ( id : string , css : string ) {
29+ if ( typeof document === 'undefined' )
30+ return
31+
32+ const element = document . getElementById ( id )
33+ if ( element )
34+ element . remove ( )
35+
36+ const head = document . querySelector ( 'head' )
37+ const style = document . createElement ( 'style' )
38+ style . setAttribute ( 'type' , 'text/css' )
39+ style . id = id
40+ style . innerHTML = css
41+ head ?. appendChild ( style )
42+ } ,
43+ }
44+
45+ export const DEFAULT_REQUEST_STUBS = {
46+ '/@vite/client' : clientStub ,
47+ '@vite/client' : clientStub ,
4548}
4649
4750export class ModuleCacheMap extends Map < string , ModuleCache > {
0 commit comments