storybook: Module not found: Error: You attempted to import /node_modules/react-refresh/runtime.js which falls outside of the project src/ directory
Describe the bug related to the new RCA 5 using @storybook/react: 6.4.9 im getting this problem https://github.com/facebook/create-react-app/issues/11810 is there a way to solve it ? if i remove this dependency works good
To Reproduce create a new RCA 5 project, and add storybook and start RCA (yarn start)
“@storybook/addon-actions”: “^6.4.9”, “@storybook/addon-essentials”: “^6.4.9”, “@storybook/addon-links”: “^6.4.9”, “@storybook/node-logger”: “^6.4.9”, “@storybook/preset-create-react-app”: “^4.0.0”, “@storybook/react”: “^6.4.9”,
System
Please paste the results of npx sb@next info here.
Additional context Add any other context about the problem here.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 15 (3 by maintainers)
Commits related to this issue
- fix: react-refresh 관련 오류 해결 https://github.com/storybookjs/storybook/issues/17049 — committed to hozzijeong/react-shopping-cart by hozzijeong a year ago
- [장바구니 미션 Step 2] 클린(정호진) 미션 제출합니다. (#199) * refactor: toast ui 종료 관련 로직 관심사 분리 * feat: localStorage get/set hook 구현 * refactor: toast 객체 생성 및 프로퍼티로 동작 추상화 * feat: msw 설치 및 초기 데이터 fetching 설정... — committed to woowacourse/react-shopping-cart by hozzijeong a year ago
Was able to find a workaround for conflict versions for the time being
npm ls react-refreshand it shows a different ofreact-refreshpackage versionsRan
npm dedupeto de-duplicate multiple versionsRan
npm ls react-refreshto check existing versions forreact-refreshnpm startcompiles & runs successfullySon of a gun!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.5 containing PR #17056 that references this issue. Upgrade today to the
@nextNPM tag to try it out!Closing this issue. Please re-open if you think there’s still more to do.
had to also do
cd node_modules/react-scripts
npm dedupe
The storybook/react need to update the dependencies version. I just check the 6.5.0-alpha.1 to 6.5.0-alpha.4, the config not update.
react-scripts@5.0.0: “@pmmmwh/react-refresh-webpack-plugin” “^0.5.3” react-refresh “^0.11.0”
storybook/react@6.4.9: “@pmmmwh/react-refresh-webpack-plugin”: ^0.5.1 react-refresh: ^0.10.0
Here is the pull request
If you can’t wait for the next version, you can do the hard code on node_modules.
After much more trial and error I can only get this to work if
react-scriptsandwebpackare in thedependencieslist and all the Storybook packages are indevDependencies(and after moving things around you have to remove the lock file andnode_modulesbefore reinstalling.)So it’s a bit messy.
https://github.com/robcaldecott/storybook-react-scripts-webpack5/blob/fix/package.json
I’m using node 14 and npm 6.14.15. It would be interesting to see if later versions of
npmsuffer from this issue.