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]: importers[path] is not a function #30147

Open
diginikkari opened this issue Dec 27, 2024 · 0 comments
Open

[Bug]: importers[path] is not a function #30147

diginikkari opened this issue Dec 27, 2024 · 0 comments

Comments

@diginikkari
Copy link

Describe the bug

After upgrading from 8.5.0-alpha.15 to 8.5.0-alpha.17. Storybook gives following error in browser:

TypeError: importers[path] is not a function
    at un2.importFn (http://localhost:4400/@id/__x00__/virtual:/@storybook/builder-vite/storybook-stories.js:285:31)
    at un2.loadEntry (http://localhost:4400/@fs/Users/Shared/repos/myapp/node_modules/.cache/storybook/e32bb427adf737087a4b39f7f748149d183fe2f95231b7a3c1529f5231d4c8d3/sb-vite/deps/storybook_internal_preview_runtime.js?v=4e363891:7627:12)
    at async bn2.prepare (http://localhost:4400/@fs/Users/Shared/repos/myapp/node_modules/.cache/storybook/e32bb427adf737087a4b39f7f748149d183fe2f95231b7a3c1529f5231d4c8d3/sb-vite/deps/storybook_internal_preview_runtime.js?v=4e363891:8521:49)
    at async Un2.renderSelection (http://localhost:4400/@fs/Users/Shared/repos/myapp/node_modules/.cache/storybook/e32bb427adf737087a4b39f7f748149d183fe2f95231b7a3c1529f5231d4c8d3/sb-vite/deps/storybook_internal_preview_runtime.js?v=4e363891:8731:7)
    at async Un2.selectSpecifiedStory (http://localhost:4400/@fs/Users/Shared/repos/myapp/node_modules/.cache/storybook/e32bb427adf737087a4b39f7f748149d183fe2f95231b7a3c1529f5231d4c8d3/sb-vite/deps/storybook_internal_preview_runtime.js?v=4e363891:8640:8)
    at async Un2.initialize (http://localhost:4400/@fs/Users/Shared/repos/myapp/node_modules/.cache/storybook/e32bb427adf737087a4b39f7f748149d183fe2f95231b7a3c1529f5231d4c8d3/sb-vite/deps/storybook_internal_preview_runtime.js?v=4e363891:8066:39)

It seems that path argument doesn't match with the generated importers properties in storybook-stories.js

e.g. path is ./libs/ui/themes/src/lib/Typography.stories.tsx when corresponding property key is ../../libs/ui/themes/src/lib/Typography.stories.tsx

// storybook-stories.js

const importers = {
  ...
  "../../libs/ui/themes/src/lib/Typography.stories.tsx": () => import("/@fs/Users/Shared/repos/myapp/libs/ui/themes/src/lib/Typography.stories.tsx"),
  ...
}

export async function importFn(path) {
  return await importers[path]();
}

Reproduction link

not yet available

Reproduction steps

No response

System

Storybook Environment Info:

  System:
    OS: macOS 15.1.1
    CPU: (12) arm64 Apple M2 Max
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm
    pnpm: 9.10.0 - ~/.nvm/versions/node/v20.18.0/bin/pnpm <----- active
  Browsers:
    Chrome: 131.0.6778.205
    Safari: 18.1.1
  npmPackages:
    @storybook/addon-actions: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    @storybook/addon-coverage: ^1.0.4 => 1.0.4 
    @storybook/addon-essentials: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    @storybook/addon-interactions: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    @storybook/addon-mdx-gfm: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    @storybook/addon-themes: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    @storybook/addon-viewport: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    @storybook/blocks: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    @storybook/core-server: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    @storybook/experimental-addon-test: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    @storybook/react: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    @storybook/react-vite: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    @storybook/test: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    @storybook/theming: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    eslint-plugin-storybook: ^0.11.1 => 0.11.1 
    storybook: 8.5.0-alpha.17 => 8.5.0-alpha.17 
    storybook-addon-remix-react-router: ^3.0.2 => 3.0.2

Additional context

My repository is NX monorepo, where there is single storybook app.

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

1 participant