question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
danezcommented, 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.

1reaction
neutraalicommented, Nov 7, 2017

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting up Babel 6
Babel 6 ships without any default transforms, so when you run Babel on a file it will just print it back out to...
Read more >
Babel 6 and Babel 7 support - Stack Overflow
In Babel 6, .babelrc configuration applies specifically to files inside subdirectories of the one containing the .babelrc .
Read more >
Configuring Babel 6 - 2ality
Babel 6 is much more configurable than Babel 5, but also more difficult to configure. This blog post gives tips.
Read more >
babel 6 - npm search
A plugin for Babel 6 supports extending from builtin types based on static analysis. ... The webpack babel-loader with support for browsers defined...
Read more >
Adding Jest to a Babel 6 project - MagmaLabs Blog
A project which uses Babel 6, and already has a .babelrc file. ... The problem is that Jest stopped supporting Babel 6 since...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found