Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update index.ts
  • Loading branch information
lxsmnsyc committed Mar 4, 2026
commit 2c7ee0f5c8933d450418ea23057f4e7468e956c3
9 changes: 5 additions & 4 deletions src/babel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,6 @@ function bubbleFunctionDeclaration(
// have zero or one parameter
decl.params.length < 2
) {
const first = program.get('body')[0];
const [tmp] = first.insertBefore(decl);
program.scope.registerDeclaration(tmp);
tmp.skip();
if (path.parentPath.isExportNamedDeclaration()) {
path.parentPath.replaceWith(
t.exportNamedDeclaration(undefined, [
Expand All @@ -324,6 +320,9 @@ function bubbleFunctionDeclaration(
} else {
path.remove();
}
const [tmp] = program.unshiftContainer('body', [decl]);
program.scope.registerDeclaration(tmp);
tmp.skip();
}
}
}
Expand Down Expand Up @@ -361,6 +360,7 @@ export default function solidRefreshPlugin(): babel.PluginObj<State> {
bubbleFunctionDeclaration(programPath, path);
},
});
programPath.scope.crawl();
if (state.jsx) {
programPath.traverse({
JSXElement(path) {
Expand All @@ -370,6 +370,7 @@ export default function solidRefreshPlugin(): babel.PluginObj<State> {
transformJSX(path);
},
});
programPath.scope.crawl();
}
programPath.traverse({
VariableDeclarator(path) {
Expand Down