-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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: Fix indexing errors by excluding node_modules stories #22873
Conversation
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.
Seems like a reasonable approach. I haven't QA-ed it yet.
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.
LGTM! Tested with both: '../**/*.stories.@(js|jsx|ts|tsx)',
and '../node_modules/*.stories.@(js|jsx|ts|tsx)'
in all 4 environments 🚀
This looks fantastic! |
…-modules Core: Fix indexing errors by excluding node_modules stories
Closes #21414 #19446
What I did
Exclude stories from
node_modules
from the story index. Starting in 7.0, we are including story files in the Storybook renderer packages, which are installed intonode_modules
. This causes errors for users whosestories
globs are configured to matchnode_modules
. Also matchingnode_modules
is a huge performance hog.Now if you want to include stories from
node_modules
you need to explicitly add that to your globs. This is described in my change toMIGRATION.md
.This is technically a breaking change but I expect it to break very few users, and the problems that it fixes were introduced in 7.0, which is still stabilizing. Hence I think it is safe to patch back.
How to test
In a sandbox:
node_modules/Dummy.jsx
containing the following content:main.js
to include the pattern../**/*.stories.@(js|jsx|ts|tsx)
.Dummy
does not appear in the sidebarcommon-glob-options.ts
(added in this PR) from '/node_modules/'to
'/@storybook/'`Dummy
appears at the top of the sidebarPerform all of the above:
features.storyStoryV7 = true
andfeatures.storyStoreV7MdxErrors = false