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

Support Babel 6 #47

Closed
oliviertassinari opened this issue Dec 20, 2015 · 10 comments
Closed

Support Babel 6 #47

oliviertassinari opened this issue Dec 20, 2015 · 10 comments

Comments

@oliviertassinari
Copy link

When using this module with a source code that is using babel 6.
I'm having this error:

TypeError: plugins.indexOf is not a function

This is from webpack:///./~/babylon/lib/parser/index.js:

if (plugins.indexOf("flow") >= 0) { // At run time plugins is an object with {flow: true, jsx: true}

I guess that upgrading the version of babylon would solve the issue.

@fkling
Copy link
Member

fkling commented Dec 21, 2015

What is the Babylon version you are using here? This rather seems to be a configuration error or an inconsistent state of your nodes_module folder. Sure, we could upgrade to a newer version of Babylon, but that shouldn't be necessary. Whatever Babel version you are using shouldn't impact react-docgen and vice versa.

@oliviertassinari
Copy link
Author

Whatever Babel version you are using shouldn't impact react-docgen and vice versa.

That's what I though, I'm gonna investigate more on this.

What is the Babylon version you are using here?

I'm using the latest release of react-docgen. I'm not using directly babylon.

@oliviertassinari
Copy link
Author

@fkling Thanks for your help! It was indend an issue with my dependences. I had two version of babylon (v5, v6), and my webpack config wasn't resolving the good one 😁.

@yrashk
Copy link

yrashk commented Jan 24, 2016

Is there any ETA for the Babel 6 upgrade? I am running into the same issue and ideally I'd rather avoid playing with module resolution in web pack.

@fkling
Copy link
Member

fkling commented Jan 24, 2016

@yrashk: There is no plan to upgrade babylon atm. Can you share information about your setup? You have to think of react-docgen as a standalone tool / library (just like eslint). Whatever setup you have shouldn't impact it, and there shouldn't be anything you have to configure differently.

However, there could be an issue when npm didn't install the correct dependencies. I guess one solution to avoid these issues could be to use bundledDependencies.

@neutraali
Copy link

Experiencing something similar to this... I can run react-docgen fine from the CLI interface, but trying to run it via code (webpack + dev-server) triggers the error. The actual error is:

TypeError: pluginList.indexOf is not a function at Parser.loadPlugins (index.js:1620)

As @oliviertassinari described originally, the pluginList -parameter is { jsx: true, flow: true } - Which is apparently gotten from babylon. Obviously said parameter is an object, not an array, which causes the indexOf -check to fail.

I've tried upgrading all my prop-types and babel -related packages to their latest versions, but that didn't help. npm list babylon version reveals that I have babylon@6.18.0 everywhere else, except react-docgen still has it as babylon@5.8.38. Could this be the issue?

@danez
Copy link
Collaborator

danez commented Nov 7, 2017

react-docgen@v2 uses babylon 5 and that will not change. We also have a beta version v3.0.0 which uses babylon 7, you can try that.

@oliviertassinari
Copy link
Author

oliviertassinari commented Nov 7, 2017

@danez Material-UI has been relying on the v3.0.0 beta for months now. It's working great.

@neutraali
Copy link

@danez tried v3-dev - But it seems that branch only has the CLI interface available (at least when installing via NPM)? Anyway I moved on to making a CLI workaround since the NodeJS API is going nowhere.

@danez
Copy link
Collaborator

danez commented Nov 7, 2017

just install with npm the latest beta

npm install react-docgen@next

Installing the branch directly won't work, as there are build steps involved when releasing.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants