File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ const defaultHotOptions = {
3838 // Svelte Native mode
3939 native : false ,
4040 // Vite mode
41+ // NOTE probably not neede anymore with Vite2, kept for compatibility with
42+ // existing Vite1 setups though
4143 compatVite : false ,
4244 // name of the adapter import binding
4345 importAdapterName : globalAdapterName ,
@@ -97,8 +99,14 @@ const renderApplyHmr = ({
9799} ) =>
98100 // this silly formatting keeps all original characters in their position,
99101 // thus saving us from having to provide a sourcemap
102+ //
103+ // NOTE the `if (false) accept()` line is for tools that wants to see the
104+ // accept call in the actual accepted module to enable HMR (Vite and, I
105+ // believe, Snowpack 3)
106+ //
100107 `${ imports . join ( ';' ) } ;${ `
101108 if (${ compatVite ? '' : `${ meta } && ` } ${ meta } .hot) {
109+ if (false) import.meta.hot.accept();
102110 $2 = ${ globalName } .applyHmr({
103111 m: ${ meta } ,
104112 id: ${ quote ( id ) } ,
@@ -109,7 +117,6 @@ const renderApplyHmr = ({
109117 cssId: ${ quote ( cssId ) } ,
110118 nonCssHash: ${ quote ( nonCssHash ) } ,
111119 });
112- ${ compatVite ? 'import.meta.hot.accept();' : '' }
113120 }
114121 `
115122 . split ( '\n' )
You can’t perform that action at this time.
0 commit comments