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
Webpack5 Builder - Stories cannot be explicitly sorted #17665
Comments
I had been on webpack5 builder for a while but started seeing this issue after one of the recent updates. |
Related: #17847 |
Here's a repro using @storybook/angular 6.5.0-alpha.55. Thanks in advance for looking into this! 😄 |
Thanks for your interest! In the future, you can receive updates by clicking the "subscribe" button on the right side of the page. 😄 |
I found a work around for this issue. The sort is occurring on the export const
So if you name the const alphabetically as you want them in your stories.ts it will work in production correctly Example below sorts correctly in production A.storyName = 'Basic'; Example below does not sort correctly in production Basic.storyName = 'Basic'; |
Obviously I would be more interested in a correct fix of course rather than work around so I will be keeping an eye on this 😀 |
I've been noticing this lately as well. Even if alphabetical is the new default, there should be a way using This would be possible if the intrinsic order were included as an integer somewhere in the sort method's callback function, but it does not appear to be. |
closing as dupe to #15574 |
This was fixed in 6.5, but is now broken again in 6.5.5. |
@symmetriq do you have a reproduction you can share? Or, specifically, can you share your |
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
], |
Also seeing this issue after switching to the webpack 5 builder.
|
Also seeing this issue after upgrading to 6.5.9, using builder webpack 5 and React. (before was in storybook 6.4.22 and webpack 4) |
For me, stories are sorted as expected (in |
You are totally right @symmetriq. I have just found the "other factor" involved. We use the filename format module.exports = {
stories: ['../src/components/**/*.example.js'],
framework: '@storybook/react',
addons: [
'@storybook/addon-actions',
'@storybook/addon-viewport',
'@storybook/addon-knobs',
'@storybook/addon-docs',
'@storybook/addon-controls',
'@storybook/addon-measure',
'@storybook/addon-outline',
],
core: {
builder: 'webpack5',
},
} After changing one story filename to So, we have an issue where we must use the proposed stories filename format to make sorting works properly. |
I open i new ticket for it #18535 |
Describe the bug
I just updated from the Webpack 4 Builder to Webpack 5, and my stories are suddenly sorted differently. Specifically, whereas they used to display in order of export, they now sort alphabetically. In other words, the below code would produce a storybook with
Later
showing up beforeMeFirst
Looked at the sorting docs, and the objects passed to the
storySort
option inparameters
, but it appears the native export order is not given to this sorting function. Is there any way to have the order of the story exports determine their appearance?System
The text was updated successfully, but these errors were encountered: