Handle 'export default' in static RAM calculation

This commit is contained in:
theit8514 2022-01-17 13:16:03 -05:00
parent 8b69fd7faa
commit 31ebdbb139

@ -388,7 +388,8 @@ function parseOnlyCalculateDeps(code: string, currentModule: string): any {
} }
}, },
FunctionDeclaration: (node: any) => { FunctionDeclaration: (node: any) => {
const key = currentModule + "." + node.id.name; // node.id will be null when using 'export default'. Add a module name indicating the default export.
const key = currentModule + "." + (node.id === null ? "__SPECIAL_DEFAULT_EXPORT__" : node.id.name);
walk.recursive(node, { key: key }, commonVisitors()); walk.recursive(node, { key: key }, commonVisitors());
}, },
}, },