File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -309,10 +309,6 @@ function bubbleFunctionDeclaration(
309309 // have zero or one parameter
310310 decl . params . length < 2
311311 ) {
312- const first = program . get ( 'body' ) [ 0 ] ;
313- const [ tmp ] = first . insertBefore ( decl ) ;
314- program . scope . registerDeclaration ( tmp ) ;
315- tmp . skip ( ) ;
316312 if ( path . parentPath . isExportNamedDeclaration ( ) ) {
317313 path . parentPath . replaceWith (
318314 t . exportNamedDeclaration ( undefined , [
@@ -324,6 +320,9 @@ function bubbleFunctionDeclaration(
324320 } else {
325321 path . remove ( ) ;
326322 }
323+ const [ tmp ] = program . unshiftContainer ( 'body' , [ decl ] ) ;
324+ program . scope . registerDeclaration ( tmp ) ;
325+ tmp . skip ( ) ;
327326 }
328327 }
329328}
@@ -361,6 +360,7 @@ export default function solidRefreshPlugin(): babel.PluginObj<State> {
361360 bubbleFunctionDeclaration ( programPath , path ) ;
362361 } ,
363362 } ) ;
363+ programPath . scope . crawl ( ) ;
364364 if ( state . jsx ) {
365365 programPath . traverse ( {
366366 JSXElement ( path ) {
@@ -370,6 +370,7 @@ export default function solidRefreshPlugin(): babel.PluginObj<State> {
370370 transformJSX ( path ) ;
371371 } ,
372372 } ) ;
373+ programPath . scope . crawl ( ) ;
373374 }
374375 programPath . traverse ( {
375376 VariableDeclarator ( path ) {
You can’t perform that action at this time.
0 commit comments