Core: Fix indexing errors by excluding node_modules stories#22873
Merged
Conversation
tmeasday
reviewed
Jun 1, 2023
Member
tmeasday
left a comment
There was a problem hiding this comment.
Seems like a reasonable approach. I haven't QA-ed it yet.
tmeasday
approved these changes
Jun 6, 2023
Member
|
This looks fantastic! |
shilman
added a commit
that referenced
this pull request
Jun 6, 2023
…-modules Core: Fix indexing errors by excluding node_modules stories
Merged
This was referenced Jun 8, 2023
8 tasks
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #21414 #19446
What I did
Exclude stories from
node_modulesfrom 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 whosestoriesglobs are configured to matchnode_modules. Also matchingnode_modulesis a huge performance hog.Now if you want to include stories from
node_modulesyou 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.jsxcontaining the following content:main.jsto include the pattern../**/*.stories.@(js|jsx|ts|tsx).Dummydoes not appear in the sidebarcommon-glob-options.ts(added in this PR) from '/node_modules/'to'/@storybook/'`Dummyappears at the top of the sidebarPerform all of the above:
features.storyStoryV7 = trueandfeatures.storyStoreV7MdxErrors = false