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

2 warnings in new example project, require cycle and duplicate decorator #240

Closed
leotm opened this issue Jul 18, 2021 · 12 comments
Closed
Labels
6.5 bug Something isn't working help wanted Extra attention is needed

Comments

@leotm
Copy link

leotm commented Jul 18, 2021

Description

2 warnings in new project

To Reproduce

  1. Fork/clone this repo
  2. yarn
  3. yarn bootstrap
  4. cd examples/native
  5. cd ios && pod install && cd ..
  6. (Revert project.pbxproj to run on M1)
  7. yarn start --reset-cache
  8. yarn ios
  9. 2 warnings present
  10. Remove cause (details below)
  11. yarn start --reset-cache
  12. yarn ios

Or

  1. Clone https://github.com/leotm/react-native-template-typescript (@storybook/react-native@5.3.25)
  2. Update App.tsx line 117 for storybook
  3. yarn
  4. cd ios && pod install && cd ..
  5. yarn start --reset-cache
  6. yarn ios
  7. 1 warning present
  8. Remove cause (details below)
  9. yarn start --reset-cache
  10. yarn ios

Expected behavior

No warnings

Screenshots

2 Warnings

1 WARN Require cycle: ../../node_modules/util/util.js -> ../../node_modules/util/node_modules/inherits/inherits.js -> ../../node_modules/util/util.js](https://github.com/facebook/metro/issues/287

facebook/metro#287

2 WARN You tried to add a duplicate decorator, this is not expected [Function anonymous]

Screenshot 2021-07-18 at 20 52 28

Cause removed, 0 Warnings

Screenshot 2021-07-18 at 21 01 14

But ofc, we need to call getStorybookUI({...})

Code snippets

import { getStorybookUI } from '@storybook/react-native';
...
StorybookUIRoot = getStorybookUI({})

System

  OS: macOS 11.4
  CPU: (8) arm64 Apple M1
Binaries:
  Node: 16.5.0 - /opt/homebrew/bin/node
  Yarn: 1.22.10 - /opt/homebrew/bin/yarn
  npm: 7.19.1 - /opt/homebrew/bin/npm
Browsers:
  Safari: 14.1.1

Additional context

StorybookUIRoot = getStorybookUI({}) in any project causes warning 1

@dannyhw
Copy link
Member

dannyhw commented Jul 18, 2021

@leotm

Thanks for this detailed issue I appreciate it 🙏 .
Actually I had noticed the dependency loop warnings when setting up a project to test the new alpha. I've not had a chance to look into it yet but now that we have this issue I'll plan it into the alpha2 milestone and hopefully we can have a fix soon.

With the duplicate decorator that sounds like it's probably related to fast reload, not sure though. I'll definitely be doing more testing over the coming days to try and find and fix as many issues as possible.

If you or anyone else is able to find the cause of these warnings then all contributions are very welcome.

Thanks for your interest in this project, I'll keep working to improve it 👍

@dannyhw dannyhw added this to the v6 alpha 2 milestone Jul 18, 2021
@dannyhw dannyhw added 6.5 bug Something isn't working help wanted Extra attention is needed labels Jul 18, 2021
@sangameshsomawar
Copy link

@dannyhw : I followed all steps mentioned here
Getting no warnings. (Just thought to inform you, I can see label as help wanted 😊)

Screenshot 2021-11-16 at 4 06 48 PM

@dannyhw
Copy link
Member

dannyhw commented Nov 16, 2021

@sangameshsomawar thanks for trying this out, does it stay without warnings if you reload the app?

@sangameshsomawar
Copy link

@dannyhw
Tried with fast reload, no warnings.
Screenshot 2021-11-16 at 5 24 52 PM

@dannyhw
Copy link
Member

dannyhw commented Nov 16, 2021

@sangameshsomawar thanks, maybe its no longer an issue then 🤔 . Or rather it's a problem in 5.3 still but for the upcoming release it will be resolved

@sangameshsomawar
Copy link

@dannyhw: Yes, the Issue will not be there in new releases I think. You can simulate and confirm once then you can close the issue. 😄

@nguyenvantruong17
Copy link

nguyenvantruong17 commented Nov 26, 2021

I got the same problem. Then, I integrated the react-hook-form and it did NOT work.
I've been debugging and I think that the problem is causing an error with react-hook-form.
Can anyone tell me how to solve this problem? Thx.

@dannyhw
Copy link
Member

dannyhw commented Nov 26, 2021

@nguyenvantruong17 are you using v6.0? or 5.3?

@nguyenvantruong17
Copy link

@nguyenvantruong17 are you using v6.0? or 5.3?

I'm using v5.3.

@nguyenvantruong17
Copy link

@nguyenvantruong17 are you using v6.0? or 5.3?

BTW. I've fixed that problem by setting inlineRequires = false in metro.config.js file.

leotm added a commit to leotm/react-native-template-new-architecture that referenced this issue Feb 3, 2022
Prompted by Dependabot false positive Security vulnerabilities of dev build tools

RN Storybook v5.3
- Remove old /storybook config
- Keep old /stories for now

RN Storybook v6
- Setup in .storybook for now
- Add minimal config w/o stories for now

Jest setup mocks
- Remove stale RN mocks
- Add new RN Storybook mocks
- Doc @storybook/addon-ondevice-notes/register parsing issue
- Doc @storybook/addon-actions ES forEach proto parsing issue

Metro
- Config resolver for modern storybook build, vs polyfilled versions
- Keep inlineRequires optimisation on, disable later if blocking

App
- Update gitignore with Storybook
- Update app Storybook require to import with new path
- Add react-native-slider and RNDateTimePicker pods
- Add get-stories script to codegen storybook.requires.js
- Update RNCAsyncStorage pod
- Remove deprecated @react-native-community/async-storage later and update Reactotron config

Relevant Dependabot Security alerts
- Upgrading Storybook should clear some, resolve remaining after
- browserslist: storybookjs/storybook#15173
- glob-parent : storybookjs/storybook#15174
- Vulnerabilities: storybookjs/storybook#16063
- immer: storybookjs/storybook#16093
- immer: storybookjs/storybook#16556

storybookjs/react-native#240
- Old v5.3 warnings no longer present, in this v6 no-stories but with addons upgrade so far
leotm added a commit to leotm/react-native-template-new-architecture that referenced this issue Feb 3, 2022
Prompted by Dependabot false positive Security vulnerabilities of dev build tools

RN Storybook v5.3
- Remove old /storybook config
- Keep old /stories for now

RN Storybook v6
- Setup in .storybook for now
- Add minimal config w/o stories for now

Jest setup mocks
- Remove stale RN mocks
- Add new RN Storybook mocks
- Doc @storybook/addon-ondevice-notes/register parsing issue
- Doc @storybook/addon-actions ES forEach proto parsing issue

Metro
- Config resolver for modern storybook build, vs polyfilled versions
- Keep inlineRequires optimisation on, disable later if blocking

App
- Update gitignore with Storybook
- Update app Storybook require to import with new path
- Add react-native-slider and RNDateTimePicker pods
- Add get-stories script to codegen storybook.requires.js
- Update RNCAsyncStorage pod
- Remove deprecated @react-native-community/async-storage later and update Reactotron config

Relevant Dependabot Security alerts
- Upgrading Storybook should clear some, resolve remaining after
- browserslist: storybookjs/storybook#15173
- glob-parent : storybookjs/storybook#15174
- Vulnerabilities: storybookjs/storybook#16063
- immer: storybookjs/storybook#16093
- immer: storybookjs/storybook#16556

storybookjs/react-native#240
- Old v5.3 warnings no longer present, in this v6 no-stories but with addons upgrade so far

After figured @storybook/addon-ondevice-notes/register Jest parsing issue
- Add generated storybook.requires.js to gitignore
- Add prestart script to get-stories first

Consider splitting/decoupling App/Storybook Jest parsing
- env var with dynamic import
- npm workspaces / lerna
- multiple modules
@leotm
Copy link
Author

leotm commented Mar 26, 2022

no longer getting both original warnings since upgrading to 6 alpha, altho getting a diff one

will upgrade to beta soon and raise separately if remains

thanks again for checking earlier @sangameshsomawar and @nguyenvantruong17

keep up the good work @dannyhw

@leotm leotm closed this as completed Mar 26, 2022
@brandon-austin-lark
Copy link

brandon-austin-lark commented Mar 30, 2022

BTW. I've fixed that problem by setting inlineRequires = false in metro.config.js file.

This is also the only solution that I have found thus far. Any file that import Storybook into, my app crashes. Just really strange behavior going on. on v.5.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.5 bug Something isn't working help wanted Extra attention is needed
Projects
Archived in project
Development

No branches or pull requests

5 participants