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

storybook bundling error #9077

Closed
hosseinalipour opened this issue Dec 5, 2019 · 12 comments
Closed

storybook bundling error #9077

hosseinalipour opened this issue Dec 5, 2019 · 12 comments

Comments

@hosseinalipour
Copy link

Describe the bug
After upgrading material-ui "4.7.1" a few days ago, I can't run storybook anymore.
this is the error given when bundling:

ERROR in ./node_modules/@material-ui/core/esm/Popper/Popper.js
Module not found: Error: Cannot find file: 'popper.js' does not match the corresponding name on disk: './node_modules/@material-ui/core/esm/Popper/Popper.js'.

in the file ./node_modules/@material-ui/core/esm/Popper/Popper.js it's importing like this:
import PopperJS from 'popper.js';
I think storybook thinks it's a file whereas popper.js is a dependency package for material-ui

@vk2r
Copy link

vk2r commented Dec 9, 2019

Same here !

@vasilii-kovalev
Copy link

The same issue for Reactstrap.
@storybook/react version: 5.2.6
reactstrap version: 8.2.0

@shilman
Copy link
Member

shilman commented Dec 27, 2019

Any Webpack gurus know what's going on here? @ndelangen @mrmckeb @Hypnosphi

@Hypnosphi
Copy link
Member

Can you please create a GitHub repo with minimal reproduction of your issue?

@vasilii-kovalev
Copy link

vasilii-kovalev commented Dec 31, 2019

@Hypnosphi, @shilman, hi! I had time to create a repository to reproduce my issue.
You can find it here.

I tried to install all necessary dependencies and reproduce the issue - everything works perfect. Then I added jsconfig.json to support absolute paths imports - it broke the Storybook build. But at the same time in development runtime the code works fine (if you'll run npm start).

@Tucker-Eric
Copy link

I was running into the same issue and I was able to fix this locally with adding the following to .storybook/webpack.config.js

module.exports = ({ config }) => {
  config.resolve.alias = {
    'popper.js$': 'popper.js/dist/esm/popper.js',
    ...config.resolve.alias
  };
  return config;
};

I think this may just be a windows issue due to case insensitivity where it's thinking poppper.js should resolve to Popper.js and the names don't match. I was receiving the error on windows but not on CentOS.

I hope this helps!

@mrmckeb
Copy link
Member

mrmckeb commented Jan 3, 2020

@Tucker-Eric can you please raise that issue with Popper? That sounds like an issue that needs to be solved... others will definitely hit this one.

@Tucker-Eric
Copy link

Looking into this a little more, this actually looks like a storybook webpack config issue. I was able to get it working with:

module.exports = ({ config }) => {
  config.resolve.modules =  ['node_modules'];
  return config;
};

config.resolve.modules previously contained ['node_modules', './'] so when Popper.js was importing popper.js webpack was initially trying to resolve it in its current directory which was triggering CaseSensitivePaths Plugin error message and not falling back to node_modules which is where popper.js should be resolved from.

@stale
Copy link

stale bot commented Jan 25, 2020

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!

@stale stale bot added the inactive label Jan 25, 2020
@shilman
Copy link
Member

shilman commented Feb 2, 2020

Son of a gun!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-alpha.3 containing PR #9324 that references this issue. Upgrade today to try it out!

You can find this prerelease 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 Feb 2, 2020
@stale stale bot removed the inactive label Feb 2, 2020
@shilman
Copy link
Member

shilman commented Feb 2, 2020

¡Ay Caramba!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.10 containing PR #9324 that references this issue. Upgrade today to try it out!

@barakplasma
Copy link

thanks @Tucker-Eric for #9077 (comment) , it was the only way for me to fix our Next.js 9.1.1 SSR builds after upgrading to Storybook 6.0.26

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