storybookjs/storybook
View on GitHub[Bug]: Unexpected ExportDefaultDeclaration warning when exporting shared config from main.ts
Open
#23,675 opened on Aug 1, 2023
bughas workaroundhelp wantedsev:S3upgrade:7.x
Repository metrics
- Stars
- (89,909 stars)
- PR merge metrics
- (Avg merge 7d 22h) (184 merged PRs in 30d)
Description
Describe the bug
I get a 5kg warning when using a custom shared storybook config across all my component libraries.
Unexpected {"type":"ExportDefaultDeclaration","start":58,"end":88,"loc":{"start":{"line":3,"column":0,"index":58,"token":4},"end":{"line":3,"column":30,"index":88,"token":7},"lines":{"infos":[{"line":"import storybookConfig from '@myorg/storybook-config'","indent":0,"locked":false,"sliceStart":0,"sliceEnd":56},{"line":"","indent":0,"locked":false,"sliceStart":0,"sliceEnd":0},{"line":"export default storybookConfig","indent":0,"locked":false,"sliceStart":0,"sliceEnd":30},{"line":"","indent":0,"locked":false,"sliceStart":0,"sliceEnd":0}],"mappings":[],"cachedSourceMap":null,"length":4,"name":null},"tokens":[{"type":{"label":"import","keyword":"import","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"import","start":0,"end":6,"loc":{"start":{"line":1,"column":0,"index":0,"token":0},"end":{"line":1,"column":6,"index":6}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"storybookConfig","start":7,"end":22,"loc":{"start":{"line":1,"column":7,"index":7,"token":1},"end":{"line":1,"column":22,"index":22,"token":2}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"from","start":23,"end":27,"loc":{"start":{"line":1,"column":23,"index":23},"end":{"line":1,"column":27,"index":27}}},{"type":{"label":"string","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"@myorg/storybook-config","start":28,"end":56,"loc":{"start":{"line":1,"column":28,"index":28,"token":3},"end":{"line":1,"column":56,"index":56,"token":4}}},{"type":{"label":"export","keyword":"export","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"export","start":58,"end":64,"loc":{"start":{"line":3,"column":0,"index":58,"token":4},"end":{"line":3,"column":6,"index":64}}},{"type":{"label":"default","keyword":"default","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"default","start":65,"end":72,"loc":{"start":{"line":3,"column":7,"index":65},"end":{"line":3,"column":14,"index":72}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"storybookConfig","start":73,"end":88,"loc":{"start":{"line":3,"column":15,"index":73},"end":{"line":3,"column":30,"index":88,"token":7}}},{"type":{"label":"eof","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"","start":89,"end":89,"loc":{"start":{"line":4,"column":0,"index":89},"end":{"line":4,"column":0,"index":89}}}],"indent":0},"exportKind":"value","declaration":{"type":"Identifier","start":73,"end":88,"loc":null,"name":"storybookConfig"}}
Possibly related to 20940. Supposedly, this warning has been fixed, but it is reemerging in v7.2.0. It's quite annoying that storybook prints such a massive warning message every time I start up storybook. Have been looking for a way to mute this, but I was not successful at that.
Expected: This warning should not print. Not a useful warning.
To Reproduce
Add this to your main.ts:
import storybookConfig from '@myorg/storybook-config'
export default storybookConfig
System
No response
Additional context
No response