You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error in console Module not found: Error: Can't resolve 'react/components/Button' in XXX.
Expected behavior
The storybook builds fine.
System:
OS: Windows10
Framework: react
Version: 4.1.6
Additional context
This comes from this PR: #5148, specifically line 87 of lib/core/src/server/preview/iframe-webpack.config.js. It adds an alias of react to node_modules/react to make sure to import the react version of the user instead of the version used by the storybook ui. The problem is that webpack doesn't lookup the folders specified in resolve.modules (i.e. src) if it finds that the imported path matches an alias.
For the time being I simply overrode the webpack config in .storybook/webpack.config.js to remove the react alias since I'm using the same version as storybook.
This is not ideal since it basically removes the feature of importing the user react version. Not sure how to fix this besides changing the src/react folder name, but that makes storybook enforce an arbitrary rule to the user code base.
The text was updated successfully, but these errors were encountered:
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!
Describe the bug
Having a
src/react
folder in the user sources breaks absolute imports with@storybook/[email protected]
.To Reproduce
Steps to reproduce the behavior:
yarn add -D @storybook/[email protected]
.src/react/components/Button.jsx
.start-storybook -p 9001 -c .storybook
.Module not found: Error: Can't resolve 'react/components/Button' in XXX
.Expected behavior
The storybook builds fine.
System:
Additional context
This comes from this PR: #5148, specifically line 87 of
lib/core/src/server/preview/iframe-webpack.config.js
. It adds an alias ofreact
tonode_modules/react
to make sure to import the react version of the user instead of the version used by the storybook ui. The problem is that webpack doesn't lookup the folders specified inresolve.modules
(i.e.src
) if it finds that the imported path matches an alias.For the time being I simply overrode the webpack config in
.storybook/webpack.config.js
to remove thereact
alias since I'm using the same version as storybook.This is not ideal since it basically removes the feature of importing the user react version. Not sure how to fix this besides changing the
src/react
folder name, but that makes storybook enforce an arbitrary rule to the user code base.The text was updated successfully, but these errors were encountered: