Thursday 2 September 2021

webpack TypeError: Cannot read property 'resolved' of undefined

I'm currently working on a project with webpack (version 5.50.0) and Storybook (version 6.3.7). The stories directory in this project is within the storybook directory.

During an update of webpack to version 5.51.1 I came across the following error when I run npm run storybook:

10% building 0/15 entries 21/55 dependencies 1/17 modules/Users/dsudol/development/projects/ca_projects/Test/node_modules/webpack/lib/FileSystemInfo.js:816
        if (entry.resolved !== undefined) return entry.resolved;
                  ^

TypeError: Cannot read property 'resolved' of undefined
    at getResolvedTimestamp 

Here's my main.js config

'use strict';

const path = require('path');

module.exports = {
  stories: [
    './**/*.stories.@(js|jsx|ts|tsx|mdx)'
  ],
  core: {
    builder: 'webpack5'
  },
  addons: [
    '@storybook/addon-links',
    '@storybook/addon-docs',
    '@storybook/addon-contexts/register',
    '@storybook/addon-controls',
    {
      name: '@storybook/addon-essentials',
      options: {
        backgrounds: true
      }
    }
  ]
};

How can I solve this without moving the stories out of the storybook directory or using an explicit path like './stories/**/*.stories.@(js|jsx|ts|tsx|mdx)'.

Tipps to Reproduce

Create a simple app with react (I did it without npm install create-react-app), webpack and Storybook. Move the stories directory inside the .storybook directory. Then change the path in main.js accordingly and run npm run storybook.



from webpack TypeError: Cannot read property 'resolved' of undefined

No comments:

Post a Comment