-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Core: Avoid framework imports from core/client #17875
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 2d5b3a3. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me, though probably not needed after #17868
We will refactor all of this in 7.0
I added a comment to |
@IanVS lets fix that? |
@tmeasday what do you have in mind? If cjs is still required for ie11 support, then I think we would need a multiple files, |
@IanVS that's not quite it:
IE11 will consume a module-less bundle created by webpack, which will happily consume ESM. CJS support in browser files is really just for storyshots and other Jest contexts. Which begs the question, why didn't my change break storyshots? |
Can this be cherry-picked into the 6.4 branch? It is causing an issue in the vite builder: #17504, due to the framework package importing from the cjs version of |
Core: Avoid framework imports from core/client
Issue:
What I did
I found that the vite builder needed to pre-bundle some of the storybook dependencies, even though they distribute ESM. One cause was the framework packages importing directly from
@storybook/core/client
, which is a cjs file that just re-exports the package index.This change allows imports of either cjs or esm in the normal fashion.
This may not be strictly necessary after https://github.com/storybookjs/storybook/pull/17868/files#diff-ed67a6365c9248d5f4412c4c904d2e3789155a763f681f8c48a63af38ba8a0f2R1 is merged, but it does seem strange to use this file to force one or the other packages to be used, rather than allowing normal node/bundler behavior.
How to test
If your answer is yes to any of these, please make sure to include it in your PR.