Skip to content

Commit

Permalink
CSF-Tools: Fix export specifier bug
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed May 29, 2024
1 parent cf0af1a commit ab9c663
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions code/lib/csf-tools/src/ConfigFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,14 @@ export class ConfigFile {
} else if (node.specifiers) {
// export { X };
node.specifiers.forEach((spec) => {
if (t.isExportSpecifier(spec) && t.isIdentifier(spec.exported)) {
if (
t.isExportSpecifier(spec) &&
t.isIdentifier(spec.local) &&
t.isIdentifier(spec.exported)
) {
const { name: localName } = spec.local;
const { name: exportName } = spec.exported;
const decl = _findVarDeclarator(exportName, parent as t.Program) as any;
const decl = _findVarDeclarator(localName, parent as t.Program) as any;
self._exports[exportName] = decl.init;
self._exportDecls[exportName] = decl;
}
Expand Down

0 comments on commit ab9c663

Please sign in to comment.