storybookjs/storybook

[Bug]: Cannot read properties of undefined (reading 'custom') in Next.js project

Open

#21,911 opened on 2023年4月4日

GitHub で見る
 (7 comments) (0 reactions) (1 assignee)TypeScript (89,909 stars) (10,058 forks)batch import
bughelp wantednextjssev:S3

説明

Describe the bug

The issue started in https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.29 and I suspect it might be related to https://github.com/storybookjs/storybook/pull/20615

To Reproduce

Check https://github.com/storybookjs/status-page Go to feat/upgrade-storybook

This has a workaround

The way to work around this issue is to customize webpack to mock out assert:

import type { StorybookConfig } from '@storybook/nextjs';
const config: StorybookConfig = {
  // ...
  webpackFinal: async (config) => {
    config.resolve = config.resolve || {};
    config.resolve.alias = {
      ...config.resolve.alias,
      // Mock assert to avoid issues like Cannot read properties of undefined (reading 'custom')
      assert: false,
    };
    return config;
  },
};
export default config;

System

No response

Additional context

No response

コントリビューターガイド