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

[Bug] cannot use some names in imports #167

Open
oxymc opened this issue Jan 29, 2024 · 4 comments
Open

[Bug] cannot use some names in imports #167

oxymc opened this issue Jan 29, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@oxymc
Copy link

oxymc commented Jan 29, 2024

Describe the bug

Can't use:
import { Menu } from './index'; in index.stories.svelte
(but it works, if 'Menu' will be changed by other word: 'DropdownMenu' for example)

Steps to reproduce the behavior

  1. Create a new sveltekit app: npm create svelte@latest <name-of-app>
  2. Now add storybook npx storybook init
  3. Now add Svelte CSF
  4. Reproduce the issue

Expected behavior

More details are in screenshots

Screenshots and/or logs

Знімок екрана 2024-01-29 о 09 15 32 Знімок екрана 2024-01-29 о 09 18 06

Environment

  • OS: macOS Sonoma 14.1.2
  • Node.js version: v18.17.1
  • NPM version: 10.0.0
  • Browser (if applicable): Chrome
  • Browser version (if applicable): 121.0.6167.85
  • Device (if applicable): MacBook Pro 2019

Additional context

Will be good to know which words are 'forbidden' too, but will be great to fix it :)

@oxymc oxymc added the bug Something isn't working label Jan 29, 2024
@j3rem1e
Copy link
Contributor

j3rem1e commented Feb 3, 2024

Do you have a repo where I can look ?

Import should be analyzed with a warning/Reallocation of the story with the same name.

@basselalsayed
Copy link

For me the issue comes with import "conflicts"

// menu.svelte

import { Menu } from './menu-base.svelte';

=> docgen error, object is not extensible

if we rename to

import { Menu as Base } from './menu-base.svelte';

it works.

I wasn't sure if the error came from this library, storybook, vite or esm lol

@JReinhold
Copy link
Collaborator

@basselalsayed can you share a repository that demonstrates this problem?

@basselalsayed
Copy link

@JReinhold yeah here you go https://github.com/basselalsayed/svelte-storybook-csf-issue

in select.svelte, try renaming the import and it works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants