React-modal: Unknown option error after stage-2 request (using react-native-web)

Created on 15 Jul 2017  路  6Comments  路  Source: reactjs/react-modal

Using v2 and v1.9.7 I'm getting same "Unknown option error" below. First it asks for es2015, then for stage-2, so I gave them with:

in .babelrc:
..."presets": ["es2015", "stage-2", "env", "react-native"],...

in webpack.config.js:
...module: {loaders: [{query: {
presets: ['es2015', 'stage-2', 'env', 'react-native'],
...

and installed both with yarn.

I am using react-native-web, [email protected], [email protected], etc...

Here is the full error:
ERROR in ./node_modules/react-modal/lib/index.js
Module build failed: ReferenceError: [BABEL] /Users/tomi/Work/test/AwesomeProject/node_modules/react-modal/lib/index.js: Unknown option: /Users/tomi/Work/test/AwesomeProject/node_modules/react/react.js.Children. Check out http://babeljs.io/docs/usage/options/ for more information about options.

A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:

Invalid:
{ presets: [{option: value}] }
Valid:
{ presets: [['presetName', {option: value}]] }

For more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options. (While processing preset: "/Users/tomi/Work/test/AwesomeProject/node_modules/react/react.js")
at Logger.error (/Users/tomi/Work/test/AwesomeProject/node_modules/babel-core/lib/transformation/file/logger.js:41:11)
at OptionManager.mergeOptions (/Users/tomi/Work/test/AwesomeProject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:226:20)
at /Users/tomi/Work/test/AwesomeProject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:14
at /Users/tomi/Work/test/AwesomeProject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:323:22
at Array.map (native)
at OptionManager.resolvePresets (/Users/tomi/Work/test/AwesomeProject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
at OptionManager.mergePresets (/Users/tomi/Work/test/AwesomeProject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
at OptionManager.mergeOptions (/Users/tomi/Work/test/AwesomeProject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
at OptionManager.init (/Users/tomi/Work/test/AwesomeProject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at File.initOptions (/Users/tomi/Work/test/AwesomeProject/node_modules/babel-core/lib/transformation/file/index.js:212:65)

Most helpful comment

Just had this issue with another project. Babel tries to load React as a preset and failing:

While processing preset: "/Users/tomi/Work/test/AwesomeProject/node_modules/react/react.js"

Which means one of your .babelrc聽mentions react聽preset but you don鈥檛 have it installed. This has fixed the issue for me:

npm i -D babel-preset-react

All 6 comments

Maybe it is related to #450.

@Tredis did you solve this problem and/or want to have a look on this issue?

I did not solve it, and I would appreciate some help. I did see that issue, but it didn't help me. I don't know how to proceed. Let me know what you guys have any ideas, Thanks

@Tredis can you reproduce this issue on a toy project (you can host on GitHub), then I'll have a look on this issue. Thank you.

Just had this issue with another project. Babel tries to load React as a preset and failing:

While processing preset: "/Users/tomi/Work/test/AwesomeProject/node_modules/react/react.js"

Which means one of your .babelrc聽mentions react聽preset but you don鈥檛 have it installed. This has fixed the issue for me:

npm i -D babel-preset-react

Released v3.1.7.

Was this page helpful?
0 / 5 - 0 ratings