Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storybook 6.5.5: "Cannot create property 'parameters' on string" when using string export with .trim(), even if excluded using excludeStories #18350

Closed
ashmind opened this issue May 28, 2022 · 1 comment

Comments

@ashmind
Copy link

ashmind commented May 28, 2022

Describe the bug
If I have an export that is a trimmed string, Storybook fails even if it is excluded using excludeStories.

export default {
    component: MyComponent,
    excludeStories: ['EXAMPLE_STRING']
};

export const EXAMPLE_STRING = 'Example'.trim();
Unexpected error while loading ./Fail.stories.tsx: Cannot create property 'parameters' on string 'Example'
 TypeError: Cannot create property 'parameters' on string 'Example'
    at Module../stories/Fail.stories.tsx (http://localhost:6007/main.iframe.bundle.js:341:27)
    at __webpack_require__ (http://localhost:6007/runtime~main.iframe.bundle.js:854:30)
    at fn (http://localhost:6007/runtime~main.iframe.bundle.js:151:20)
    at webpackContext (http://localhost:6007/main.iframe.bundle.js:226:9)
    at http://localhost:6007/vendors~main.iframe.bundle.js:15732:29
    at Array.forEach (<anonymous>)
    at http://localhost:6007/vendors~main.iframe.bundle.js:15730:18
    at Array.forEach (<anonymous>)
    at executeLoadable (http://localhost:6007/vendors~main.iframe.bundle.js:15729:10)
    at executeLoadableForChanges (http://localhost:6007/vendors~main.iframe.bundle.js:15778:20)

The issue does not happen if export does not call .trim().

To Reproduce
Repo: https://github.com/ashmind/bugs-storybook-trim-string-export/tree/main/stories
See:

  • Fail.stories.tsx for failure
  • Success.stories.tsx for similar cases that do not fail

System

Environment Info:
  System:
    OS: Windows 10 10.0.19044
    CPU: (4) x64 Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 101.0.4951.67
    Edge: Spartan (44.19041.1266.0), Chromium (101.0.1210.53)
@ashmind ashmind changed the title Storybook 6.5.5: "Cannot create property 'parameters' on string" when using string export with .trim(), even if excluded using excludeStories Storybook 6.5.5: "Cannot create property 'parameters' on string" when using string export with .trim(), even if excluded using excludeStories May 28, 2022
@shilman shilman added csf and removed needs triage labels Jun 9, 2023
@shilman
Copy link
Member

shilman commented Jun 9, 2023

We’re cleaning house! Storybook has changed a lot since this issue was created and we don’t know if it’s still valid. Please open a new issue referencing this one if:

@shilman shilman closed this as not planned Won't fix, can't repro, duplicate, stale Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants