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

Set up addon channel before importing addons #301

Merged
merged 3 commits into from
Apr 2, 2022
Merged

Conversation

IanVS
Copy link
Member

@IanVS IanVS commented Apr 1, 2022

Fixes storybookjs/storybook#17852

This also re-organizes our virtual filenames a bit, putting them in a single file that can be imported from various spots, rather than having to pass around the strings as extra options.

To fix the issue, I pulled out the code that sets up the addon channel from the "modern" approach, and import that at the start of the non-static-store code. It needed to be a separate file due to the way es module imports work, otherwise addon code will be imported before the channel can be created, if we tried to do it all in one file. Bonus points for getting to share some code between the two approaches, I guess.

@IanVS IanVS changed the title Consolidate virtual file name constants in one place Set up addon channel before importing addons Apr 1, 2022
@shilman shilman added the bug Something isn't working label Apr 2, 2022
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.

@IanVS much cleaner! ❤️

is there any way I can test this easily in the monorepo? i tried downgrading the packages in examples/react to 6.4 (because oddly the error doesn't repro in 6.5?!) but i got a yarn install error.

@shilman
Copy link
Member

shilman commented Apr 2, 2022

Nevermind, I had to regenerate the lockfile. Tested and this appears to fix the problem 🎉

@shilman shilman merged commit 902a8a1 into main Apr 2, 2022
@shilman shilman deleted the setup-addon-channel branch April 2, 2022 01:28
@IanVS
Copy link
Member Author

IanVS commented Apr 2, 2022

I'm not sure why you would have had to recreate the lock file. Maybe if it happens again, you could try a git clean and a fresh yarn install. Also, when changing react versions, it's best to change them in all examples, otherwise we've seen problems where mixed versions of storybook packages are used due to whatever way yarn does or doesn't hoist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Storybook does not load on browser: Accessing non-existent addons channel error
2 participants