Describe the bug
When trying to switch to CSF none of my stories were loading. Looking at the docs it seems like you can now call configure a little differently:
configure(require.context('../stories', true, /\.stories\.js$/), module);
When i switch my config.js to this the CSF stories load. but when I use the old way I am greeted with no stories and no helpful error message.
the old way
function loadStories() {
const req = require.context(
require.context('../stories', true, /\.stories\.js$/)
);
req.keys().forEach(req);
}
configure(loadStories, module);
To Reproduce
Steps to reproduce the behavior:
yarnyarn storybookExpected behavior
Loads the stories.
System:
Please paste the results of npx -p @storybook/cli@next sb info here.
@hipstersmoothie It's not supposed to and it actually can't. It's documented here: https://storybook.js.org/docs/basics/writing-stories/#loading-stories
Ah I see it looks like I was almost doing the right thing. I just have to return the required stories.
CFS isn't loaded also if I use require-context.macro as described here https://www.npmjs.com/package/@storybook/addon-storyshots#configure-jest-to-work-with-webpacks-requirecontext (Option 2)
So tests don't work with migrated stories :(
@sergej-s I think that's being addressed by #8000 ?
Also I followed CSF closely I seem to have missed that part every time 馃 You also can't mix'n'match the old format and new format correct? (Loader function passed to 'configure' should return void or an array of module exports that all contain a 'default' export.)
@donaldpipowitch You can mix and match, you just need to do it deliberately. See the last code example here:
Most helpful comment
@donaldpipowitch You can mix and match, you just need to do it deliberately. See the last code example here:
https://github.com/storybookjs/storybook/blob/next/docs/src/pages/basics/writing-stories/index.md#loading-stories