Skip to content

Cannot call component folder switch #19288

@cge-taal

Description

@cge-taal

Describe the bug

Storybook hangs when I call a component's containing folder switch.

To Reproduce

  • create a simple src/components/switch/index.tsx and src/components/switch/index.stories.tsx
  • run yarn storybook
  • see the storybook launch, but the spinner continues forever.

In the Brave browser dev console the error reads Uncaught SyntaxError: Unexpected token '.'

In Firefox it points to this part of the generated code in main.iframe.bundle.js:

try {
    // @ts-ignore
    switch.displayName = "switch";
    // @ts-ignore

Now rename the folder from switch to switchh to get src/components/switchh/index.tsx and src/components/switchh/index.stories.tsx and relaunch storybook to see it all working again.

System

$ npx sb@next info

Environment Info:

  System:
    OS: macOS 12.6
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 16.13.2 - /usr/local/bin/node
    Yarn: 1.19.0 - /opt/homebrew/bin/yarn
    npm: 8.1.2 - /usr/local/bin/npm
  Browsers:
    Chrome: 105.0.5195.125
    Edge: 105.0.1343.53
    Safari: 16.0

Additional context

  "@storybook/react": "^6.5.12",
  "react": "^18.2.0",
  "react-dom": "^18.2.0",

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions