Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional Chaining and null coalescing not working #1660

Closed
rlesniak opened this issue Aug 13, 2020 · 4 comments
Closed

Optional Chaining and null coalescing not working #1660

rlesniak opened this issue Aug 13, 2020 · 4 comments

Comments

@rlesniak
Copy link

Current behavior
Latest version of Styleguide uses Babel v.7.9.0. Since of v7.8.0 babel supports optional chaining (https://babeljs.io/blog/2020/01/11/7.8.0) but when I use it obj?.prop in styleguide environment app doesnt start and throws error

Module parse failed: Unexpected token (20:36)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|   id: getConversationId({
|     appId: conversation.app.id,
>     contactId: conversation.contact?.id
|   }),
|   contactId: conversation.contact?.id,

To reproduce

rlesniak/example@8fdeeac

Expected behavior

Should work with that features

@MoltenCoffee
Copy link

MoltenCoffee commented Aug 14, 2020

I believe this is an issue with Babel via React-docgen, as seen here.
The workaround suggested there (by @mjhenkes ) is to use specific versions of @babel/core and @babel/parser, but that hardly seems like a proper resolution, especially when using styleguidist..

Edit: see this issue as well

@mjhenkes
Copy link

+1 My work around is not great.

@sapegin
Copy link
Member

sapegin commented Aug 24, 2020

We only use Babel to compile Styleguidist code, if you see any warning like this, they are coming from your project.

@sapegin sapegin closed this as completed Aug 24, 2020
@MoltenCoffee
Copy link

I believe this is not completely true, as it's Babel/ast-types as used by React-docgen. Which still perhaps does not make it an issue with styleguidist necessarily, as it has been present in issues with storybook as well.

However, I do think this is still an issue and shouldn't be closed, but the only fix is for this issue in ast-types to be fixed, react-docgen updating its dependencies and then styleguidist as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants