Support Babel 6
See original GitHub issueWhen 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:
- Created 8 years ago
- Reactions:1
- Comments:10 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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 frombabylon
. Obviously said parameter is an object, not an array, which causes theindexOf
-check to fail.I’ve tried upgrading all my
prop-types
andbabel
-related packages to their latest versions, but that didn’t help.npm list babylon version
reveals that I havebabylon@6.18.0
everywhere else, exceptreact-docgen
still has it asbabylon@5.8.38
. Could this be the issue?