#Docgen `export default` issue with storybook7

24 messages · Page 1 of 1 (latest)

warm heron
#

Is anyone using Chromatic with v7 yet? I get a lot of errors that I assume result from v7's removal of the transpiling-by-default behaviour:

ERR! Unexpected token: keyword (default) [5039.bundle.js:882,4]
ERR!     at js_error (/Users/jon/Developer/web/node_modules/terser/dist/bundle.min.js:554:11)
ERR!     at croak (/Users/jon/Developer/web/node_modules/terser/dist/bundle.min.js:1278:9)
ERR!     at token_error (/Users/jon/Developer/web/node_modules/terser/dist/bundle.min.js:1286:9)
ERR!     at unexpected (/Users/jon/Developer/web/node_modules/terser/dist/bundle.min.js:1292:9)
ERR!     at statement (/Users/jon/Developer/web/node_modules/terser/dist/bundle.min.js:1556:9)
ERR!     at _embed_tokens_wrapper (/Users/jon/Developer/web/node_modules/terser/dist/bundle.min.js:1343:26)
ERR!     at block_ (/Users/jon/Developer/web/node_modules/terser/dist/bundle.min.js:2182:20)
ERR!     at try_ (/Users/jon/Developer/web/node_modules/terser/dist/bundle.min.js:2222:20)
ERR!     at statement (/Users/jon/Developer/web/node_modules/terser/dist/bundle.min.js:1517:24)
ERR!     at _embed_tokens_wrapper (/Users/jon/Developer/web/node_modules/terser/dist/bundle.min.js:1343:26)
tacit nimbus
#

Chromatic should work fine with v7. Do you get the same errors when you build storybook?

warm heron
#

... huh. Yep, sorry - I jumped the gun here. It's nothing to do with chromatic, I've got something affecting the entire storybook.

warm heron
#

Urgh, it's something in the recent react-docgen switch, which is now generating code like default.__docgenInfo = { ... } . Looks like there's a few previous reports but no actual fix

dreamy raven
#

@warm heron Can you provide a reproduction?

tacit nimbus
#

Are you using vite or webpack? And how are you exporting your components?

warm heron
#

@dreamy raven yep, will file an issue

#

@tacit nimbus webpack. It occurs when using export default function MyComponent ... rather than function MyComponent ... ; export default MyComponent

tacit nimbus
#

Are you using typescript?

warm heron
#

yep

tacit nimbus
warm heron
#

Yeah, agreed. I see storybook recently switched from a fork back to the official version

tacit nimbus
#
GitHub

I need to update to v1.0.5 to account for a bug (#58) that was fixed and published with that version, according to this repo's releases. However, when trying to update, I could not get the ...

warm heron
#

~Chromatic with storybook7?~ Docgen issue with storybook7

#

Docgen export default issue with storybook7

polar dune
#

Hmm, I'm seeing the latest version here:

polar dune
#

@tacit nimbus @storybook/react-docgen-typescript-plugin is a working fork. AFAICT the main project has a bug. i'm not sure whether to try to fix the bug in the main project or just revert to the fork (which is working)

tacit nimbus
polar dune
#

Yeah it doesn't have any of the changes from the main project

#

(which seems to be a feature in this case 😄 )

warm heron
#

Ahh boo - saw you reverted it. Sorry to be a pain