error: 'Plugin 0 provided an invalid property of "default"' when using with React Native + TypeScript
See original GitHub issueIf you are reporting a bug or requesting support, start here:
Bug or support request summary
Failing to compile when trying to use with React Native + Typescript:
yarn storybook start -p 7007 --metro-config $PWD/rn-cli.config.js
ERROR in ./storybook/addons.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Plugin 0 specified in "/Users/***/node_modules/babel-preset-react-native/index.js" provided an invalid property of "default" (While processing preset: "/Users/***/node_modules/babel-preset-react-native/index.js")
at Plugin.init (/Users/***/node_modules/babel-core/lib/transformation/plugin.js:131:13)
at Function.normalisePlugin (/Users/***/node_modules/babel-core/lib/transformation/file/options/option-manager.js:152:12)
at /Users/***/node_modules/babel-core/lib/transformation/file/options/option-manager.js:184:30
at Array.map (<anonymous>)
at Function.normalisePlugins (/Users/***/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
at OptionManager.mergeOptions (/Users/***/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
at /Users/***/node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:14
at /Users/***/node_modules/babel-core/lib/transformation/file/options/option-manager.js:323:22
at Array.map (<anonymous>)
at OptionManager.resolvePresets (/Users/***/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
@ multi ./storybook/addons.js ./node_modules/@storybook/react-native/dist/manager/index.js manager[0]
Steps to reproduce:
- Create a new react-native app:
react-native init test --template typescript
- Setup typescript support :
cd test && node setup.js
getstorybook
- replace storybook command with
storybook start -p 7007 --metro-config $PWD/rn-cli.config.js
- Run
yarn storybook
Please specify which version of Storybook and optionally any affected addons that you’re running
"@storybook/react-native": "4.0.0-alpha.2",
"@storybook/addon-actions": "4.0.0-alpha.2",
"@storybook/addon-links": "4.0.0-alpha.2",
"@storybook/addons": "4.0.0-alpha.2"
Screenshots / Screencast / Code Snippets (Optional)
.babelrc:
{
"presets": ["react-native"]
}
.tsconfig:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "react",
"lib": ["es6"],
"module": "es6",
"moduleResolution": "node",
"noEmit": true,
"noImplicitAny": true,
"target": "es2015"
},
"exclude": ["node_modules"]
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:36 (4 by maintainers)
Top Results From Across the Web
bundling failed: Error: Plugin 0 provided an invalid property of ...
This is bug in babel-preset-react-native. Set the version: yarn remove babel-preset-react-native yarn add babel-preset-react-native@2.1.0.
Read more >bundling failed: Error: Plugin 0 provided an invalid property of ...
Coding example for the question bundling failed: Error: Plugin 0 provided an invalid property of "default"-React Native.
Read more >Troubleshooting | React Navigation
Troubleshooting. This section attempts to outline issues that users frequently encounter when first getting accustomed to using React Navigation.
Read more >babel/plugin-transform-react-jsx
Though the JSX spec allows this, it is disabled by default since React's JSX does not currently have support for it. You can...
Read more >eslint-plugin-react - npm
React specific linting rules for ESLint. Latest version: 7.31.11, last published: a month ago. Start using eslint-plugin-react in your ...
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
also bumping these dependencies seems to have fixed it for me:
Replace your package.json to exactly code bellow:
{ "name": "reactunitytest", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "react": "16.4.1", "react-native": "0.55.0", "react-native-unity-view": "^1.1.2" }, "devDependencies": { "babel-jest": "23.4.0", "babel-preset-react-native": "2.1.0", "jest": "23.4.1", "react-test-renderer": "16.4.1" }, "jest": { "preset": "react-native" } }
Restart your Metro bundle service and to be happy!