File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,10 @@ const babelPluginUntyped: PluginItem = function (
101101 }
102102
103103 // Do not add meta to internal functions
104- if ( p . parent . type !== "ExportNamedDeclaration" ) {
104+ if (
105+ p . parent . type !== "ExportNamedDeclaration" &&
106+ p . parent . type !== "ExportDefaultDeclaration"
107+ ) {
105108 return ;
106109 }
107110
@@ -188,14 +191,18 @@ const babelPluginUntyped: PluginItem = function (
188191 } ) ;
189192
190193 // Replace function with it's meta
191- p . replaceWith (
192- t . variableDeclaration ( "const" , [
193- t . variableDeclarator (
194- t . identifier ( p . node . id . name ) ,
195- astify ( { $schema : schema } )
196- ) ,
197- ] )
198- ) ;
194+ if ( p . parent . type === "ExportDefaultDeclaration" ) {
195+ p . replaceWith ( astify ( { $schema : schema } ) ) ;
196+ } else {
197+ p . replaceWith (
198+ t . variableDeclaration ( "const" , [
199+ t . variableDeclarator (
200+ t . identifier ( p . node . id . name ) ,
201+ astify ( { $schema : schema } )
202+ ) ,
203+ ] )
204+ ) ;
205+ }
199206 } ,
200207 } ,
201208 } ;
You can’t perform that action at this time.
0 commit comments