storybook: TypeError: Cannot read property 'module' of undefined
I’m using the latest Storybook: 5.0.0
I’m using React generated with create-react-app with the --typescript flag. Following this guide; https://storybook.js.org/docs/configurations/typescript-config/#setting-up-typescript-with-babel-loader
I get the following error: TypeError: Cannot read property ‘module’ of undefined
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 17
- Comments: 17 (7 by maintainers)
Logging the three variables in the line
(baseConfig, env, config) => {shows that the latter two areundefinedwith v5. ThebaseConfigobject has aconfigkey whose value is an object with the keysmoduleandresolve.I don’t have any grasp on what the aforementioned trio of variables are intended to represent, but I did find that changing the enclosing function got me up and running. My
webpack.config.jsnow contains:@jangerhofer For me at least, the issue arises in upgrading Storybook from 4.x to 5 on my existing TypeScript CRA app, per the upgrade guide.
same issue I guess
I figured, it out. It’s been a long day haha. I forgot my curly braces
@DanRYoung did you get this figured out? There was a bug in “extend-mode” webpack config that got fixed in 5.0.2 https://github.com/storybooks/storybook/blob/next/MIGRATION.md#deprecate-webpack-extend-mode
@filiplindbladh: Are you blocked by any error in particular? I just tried using the
npx -p @storybook/cli sb initset up method on a fresh Create-React-App Typescript project, and thewebpack.config.jsbelow (straight from the docs) worked on the first go for me.@tograd Thanks for your reply!
I misunderstood what you said as I’m having a different issue where this bit of code
require.context('../stories', true, /.stories.tsx$/)is not actually looking only in the../storiesfolder, but rather everywhere, starting from root.