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

CSF: Use __namedExportsOrder array in loader if provided #9315

Merged
merged 2 commits into from
Jan 4, 2020

Conversation

daKmoR
Copy link
Contributor

@daKmoR daKmoR commented Jan 3, 2020

closes #9136
follow up of #9181

What I did

As discussed in #9181 there have been 2 solutions to guarantee a story order if loaded via es modules. I went for the object. However, I have been missing the use case of rexports

const myStory = () => html`Foo`;
export { myStory as notMyStory };

which currently produces the following export const __orderedExports = { notMyStory }; which fails as notMyStory is not a local variable.

Therefore we should go with the previously discussed array of strings.

This Pull Request changes how loaders can guarantee the order of stories

Before:

export const __orderedExports = { notMyStory };

After:

export const __namedExportsOrder = ['notMyStory'];

How to test

  • use storybook without webpack and provide this export

Notes

Related PR where we found the issue
open-wc/open-wc#1171

@vercel
Copy link

vercel bot commented Jan 3, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/storybook/monorepo/b9wqxwham
✅ Preview: https://monorepo-git-use-array-for-named-exports.storybook.now.sh

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shilman shilman added this to the 5.3.0 milestone Jan 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSF story order depends on webpack and breaks with vanilla es module imports
3 participants