Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin/Preset files are not allowed to export objects, only functions #5249

Closed
krini opened this issue Jan 15, 2019 · 10 comments
Closed

Plugin/Preset files are not allowed to export objects, only functions #5249

krini opened this issue Jan 15, 2019 · 10 comments

Comments

@krini
Copy link

krini commented Jan 15, 2019

Describe the bug
I'm trying to run the storybook together with expo. But when I try to start storybook on web I get this error:

ERROR in ./storybook/addons.js Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Plugin/Preset files are not allowed to export objects, only functions. In /Users/kristoffernielsen/repos/app/storybook/node_modules/babel-preset-react/lib/index.js

To Reproduce
Steps to reproduce the behavior:

  1. yarn storybook

Expected behavior
Storybook will start.

System:

  • OS: MacOS
  • Framework: [react
  • Addons: addon-actions, addon-links, addon-knobs - but it fails even though I remove them from addons.js

package.json
"dependencies": {
"expo": "^32.0.0",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz"
},
"devDependencies": {
"@storybook/addon-actions": "^4.1.6",
"@storybook/addon-knobs": "^4.1.6",
"@storybook/addon-links": "^4.1.6",
"@storybook/addon-ondevice-knobs": "^4.1.6",
"@storybook/addon-ondevice-notes": "^4.1.6",
"@storybook/addons": "^4.1.6",
"@storybook/react-native": "^4.1.6",
"babel-core": "^6.26.3",
"babel-preset-expo": "^5.0.0",
"babel-runtime": "^6.26.0",
"prop-types": "^15.6.2",
"react-dom": "16.5.0"
},

babel.config.js
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};

Additional context
Add any other context about the problem here.

@krini krini changed the title Cannot run yarn storybook together with expo Plugin/Preset files are not allowed to export objects, only functions Jan 15, 2019
@jwrlee88
Copy link

I have the exact same setup and running into the same issue.

My steps to come to this error were:

  1. expo init
  2. npx -p @storybook/cli sb init
  3. npm run storybook

@fa-aaron
Copy link

I am having this same issue and not able to resolve :(

"dependencies": {
"@expo/samples": "2.1.1",
"apsl-react-native-button": "^3.1.1",
"babel-loader": "8",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.7.1",
"expo": "^32.0.0",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-navigation": "^3.0.9"
},
"devDependencies": {
"@storybook/addon-actions": "^4.1.7",
"@storybook/addon-links": "^4.1.7",
"@storybook/addons": "^4.1.7",
"@storybook/react-native": "^4.1.7",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-preset-expo": "^5.0.0",
"babel-runtime": "^6.26.0",
"eslint": "^5.12.1",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^3.5.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-react-native": "^3.6.0",
"jest-expo": "^32.0.0",
"prop-types": "^15.6.2",
"react-dom": "^16.7.0"
}

module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
use: 'babel-loader',
};
};

@igor-dv igor-dv mentioned this issue Jan 20, 2019
8 tasks
@shilman
Copy link
Member

shilman commented Jan 20, 2019

I believe this is a babel 6/7 version mismatch issue, duplicate of #4011. It's being addressed in #4942, which is slated to go out in Storybook v5, hopefully ready to test in a few weeks. Will post here as soon as it's ready!

@shilman
Copy link
Member

shilman commented Mar 12, 2019

FYI the RN changes got delayed.

SB5 launched last week without RN: https://medium.com/storybookjs/storybook-5-0-db1d0f9c83b8

We'll try to release an updated RN on 5.1-alpha in the coming two weeks.

@shilman shilman reopened this Mar 12, 2019
@stale stale bot removed the inactive label Mar 12, 2019
@storybookjs storybookjs deleted a comment from stale bot Mar 14, 2019
@storybookjs storybookjs deleted a comment from stale bot Mar 14, 2019
@Aleksion
Copy link

@shilman so @storybook 5 doesn't work with react native right now?

@shilman
Copy link
Member

shilman commented Mar 15, 2019

@Aleksion we just got it merged, so the next version of 5.1-alpha should contain it

@shilman
Copy link
Member

shilman commented Mar 16, 2019

Gadzooks!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-alpha.7 containing PR #4942 that references this issue. Upgrade today to try it out!

Because it's a pre-release you can find it on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Mar 16, 2019
@andyford
Copy link

I ran into this problem when we bumped babel-loader from 7.1.5 up to 8.0.5. Rolling babel-loader back to 7.1.5 worked in our situation. (your mileage may vary)

@minardimedia
Copy link

minardimedia commented Jul 2, 2019

I also had this issue I just change the babel-loader from 8.0.6 to 7.1.5 and it worked

tianzhich pushed a commit to tianzhich/react-clap-button that referenced this issue Nov 20, 2019
@codesinghanoop
Copy link

If someone is still facing this issue then please upgrade your babel-core version to latest. npm install babel-core@latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants