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]: I cannot name stories stories.tsx #23923

Closed
MoSattler opened this issue Aug 23, 2023 · 2 comments · Fixed by #23974
Closed

[Bug]: I cannot name stories stories.tsx #23923

MoSattler opened this issue Aug 23, 2023 · 2 comments · Fixed by #23974

Comments

@MoSattler
Copy link

Describe the bug

When naming stories like this: stories.tsx, I get this error:

 Error: Invariant failed: No matching indexer found for /Users/user/server/app/components/Link/stories.tsx
    at invariant (/Users/user/server/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:14:11)
    at StoryIndexGenerator.extractStories (/Users/user/server/node_modules/@storybook/core-server/dist/index.js:60:4143)
    at /Users/user/server/node_modules/@storybook/core-server/dist/index.js:60:2601
    at /Users/user/server/node_modules/@storybook/core-server/dist/index.js:60:2058
    at Array.map (<anonymous>)
    at /Users/user/server/node_modules/@storybook/core-server/dist/index.js:60:1965
    at Array.map (<anonymous>)
    at StoryIndexGenerator.updateExtracted (/Users/user/server/node_modules/@storybook/core-server/dist/index.js:60:1718)
    at StoryIndexGenerator.ensureExtracted (/Users/user/server/node_modules/@storybook/core-server/dist/index.js:60:2517)
    at StoryIndexGenerator.initialize (/Users/user/server/node_modules/@storybook/core-server/dist/index.js:60:1622)

This on the other hand works:

Something.stories.tsx

To Reproduce

No response

System

Environment Info:

  System:
    OS: macOS 13.4.1
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.0/bin/npm
  Browsers:
    Chrome: 116.0.5845.110
    Safari: 16.5.2
  npmPackages:
    @storybook/addon-essentials: 7.3.2 => 7.3.2 
    @storybook/addon-interactions: 7.3.2 => 7.3.2 
    @storybook/addon-links: 7.3.2 => 7.3.2 
    @storybook/addon-onboarding: 1.0.8 => 1.0.8 
    @storybook/addon-styling: 1.3.6 => 1.3.6 
    @storybook/blocks: 7.3.2 => 7.3.2 
    @storybook/react: 7.3.2 => 7.3.2 
    @storybook/react-vite: 7.3.2 => 7.3.2 
    @storybook/testing-library: 0.2.0 => 0.2.0

Additional context

main.ts file:

import type { StorybookConfig } from "@storybook/react-vite";

const config: StorybookConfig = {
  stories: [
    "../app/components/**/stories.tsx",
    "../app/components/**/*.stories.@(ts|tsx)",
    "../app/utils/styles/**/*.stories.@(ts|tsx)",
  ],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-onboarding",
    "@storybook/addon-interactions",
    {
      name: "@storybook/addon-styling",
      options: {},
    },
  ],
  framework: {
    name: "@storybook/react-vite",
    options: {},
  },
  docs: {
    autodocs: "tag",
  },
};
export default config;
@sudiptosen
Copy link

For now I reverted back to my v7.0.26 to get it working.

@tommiv
Copy link

tommiv commented Aug 25, 2023

I have the same issue with plain .ts stories (without TSX), even with minimal ones like below. It works well with SB v7.2.1, without any other changes in a build config (actually without any changes whatsoever)

import Component from './component.vue';

export default {
    title: 'Some/Path',
    component: Component,
};

export const Default = {
    args: {
        id: 1,
        title: 'Title',
    },
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants