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.

error: 'Plugin 0 provided an invalid property of "default"' when using with React Native + TypeScript

See original GitHub issue

If 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:

  1. Create a new react-native app: react-native init test --template typescript
  2. Setup typescript support : cd test && node setup.js
  3. getstorybook
  4. replace storybook command with storybook start -p 7007 --metro-config $PWD/rn-cli.config.js
  5. 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:closed
  • Created 5 years ago
  • Reactions:11
  • Comments:36 (4 by maintainers)

github_iconTop GitHub Comments

33reactions
swese44commented, Jul 19, 2018

also bumping these dependencies seems to have fixed it for me:

"@babel/core": "^7.0.0-beta",
"babel-core": "^7.0.0-beta",
"babel-runtime": "^7.0.0-beta",
31reactions
hersonrodriguescommented, Aug 8, 2018

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!

Read more comments on GitHub >

github_iconTop 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 >

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