Storybook: [v6.0.0-beta.6] Glob not finding stories files

Created on 13 May 2020  ·  14Comments  ·  Source: storybookjs/storybook

Describe the bug
Using the same main.js stories configuration as v5.3 fails to find story files in v6.0.0-beta.6.

main.js:

module.exports = {
  stories: ['../packages/**/@(stories.tsx|*.stories.tsx)']
}

This warning shows up when running storybook
image

To Reproduce
Steps to reproduce the behavior:

  1. Update storybook packages to v6.0.0-beta.6
  2. Run storybook
bug cli

Most helpful comment

@yannbf yeah just saw that, fixed it adding @ now:

"../src/**/*.stories.@(ts|tsx|js|jsx)"

All 14 comments

I see this also. It appears to be a false positive as my stories load.

Hey @alexcheuk thanks a lot for opening this issue! A fix is being cooked at the moment 👨‍🍳

I see this also. It appears to be a false positive as my stories load

Unfortunately it's not a false positive..

The value of stories is supposed to be a valid glob. We plan to optimize storybook by moving from a regex evaluated in webpack to a glob evaluated by node.

But we made a mistake, when we wrote the original globs in our docs & CLI generators. It's actually an invalid glob, but it still works, because the glob-to-regex lib makes it work.

In the future instead of using a glob-to-regex we'll use glob solely.

We'll add instructions to migration.md & make the warning clearer on what's really happening.

We'll keep the invalid globs working in storybook for now, but they will break at some point in the future.

But I get the warning with ../packages/**/*.stories.js that's a vaild Glob is it not?

WARN We found no files matching any of the following globs:
WARN
WARN ../packages/**/*.stories.js

interesting, I'll investigate!

I get this issue in 6.0.0-beta.16.

It says the glob is invalid, but my stories are found and displayed in the GUI.
(Removing the glob makes the warning go away, but no stories are found. :) )

Is there any way to make the warning go away? Can I format the glob differently?

Tried generating from scratch with CRA and sb init. Same thing.

Gadzooks!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-beta.18 containing PR #10926 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

I confirm the issue is fixed. I was seeing error message for "../components/**/*.stories.mdx" in 6.0.0-beta.5 and they are no longer there after upgrade to 6.0.0-beta.20.

I am on 6.0.0-beta.37 and still see it

nfo => Loading custom manager config.
WARN We found no files matching any of the following globs:
WARN
WARN ../src/**/*.stories.(ts|tsx|js|jsx)
WARN
WARN Maybe your glob was invalid?

Hey @gastonmorixe could you please share your glob in main.js? Did you see in the migration file in that the glob format is different than previously used in examples?

https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#correct-globs-in-mainjs

@yannbf yeah just saw that, fixed it adding @ now:

"../src/**/*.stories.@(ts|tsx|js|jsx)"

@gastonmorixe - do you have any presets defined. I'm getting a WebpackOptionsValidationError when adding addon-docs/preset like so:

module.exports = {
  presets: ['@storybook/addon-docs/preset'],
  stories: ['../packages/**/stories/*.stories.@(ts|tsx|mdx)'],
  addons: [
    '@storybook/addon-actions',
    '@storybook/addon-links',
    '@storybook/addon-docs',
    '@storybook/addon-a11y/register',
    '@storybook/addon-viewport/register',
    '@storybook/addon-knobs/register'
  ]
};

Could you please point out to a complete specification of what's a correct glob?

Was this page helpful?
0 / 5 - 0 ratings