storybookjs/storybook

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

開放

#21,911 建立於 2023年4月4日

 (7 則留言) (0 個反應) (1 位負責人)TypeScript (10,058 個分叉)batch import
bughelp wantednextjssev:S3

倉庫指標

星標
 (89,909 顆星)
PR 合併指標
 (平均合併 7天 22小時) (30 天內合併 184 個 PR)

描述

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

貢獻者指南