storybookjs/storybook

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

Open

#21,911 创建于 2023年4月4日

在 GitHub 查看
 (7 评论) (0 反应) (1 负责人)TypeScript (89,909 star) (10,058 fork)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

贡献者指南