WS-NA: Makes nextjs storybook path explicit - #14241
Open
Isabella-Mitchell wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Storybook configuration to avoid picking up copied .stories.tsx files from ws-nextjs-app/build/standalone after running a local Next.js standalone build, which can break Storybook due to unresolved relative imports.
Changes:
- Narrows the Storybook stories glob for
ws-nextjs-appfrom the whole app to onlyws-nextjs-app/pages/**, implicitly excluding build output. - Keeps existing Storybook story discovery for the legacy and
src/appareas unchanged.
| './DocsDecorator/**/*.stories.@(t|j)sx', | ||
| './StorybookComponents/**/*.stories.@(t|j)sx', | ||
| '../ws-nextjs-app/**/*.stories.tsx', | ||
| '../ws-nextjs-app/pages/**/*.stories.tsx', |
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.
Resolves JIRA: WS-NA (context here)
Summary
I had to manually delete my build file to get Storybook to work locally. This change would prevent the need to do this manually. (But we can just delete it manually - so this PR might be extra)
Copilot: "Running next build locally copies all source files — including .stories.tsx files — into ws-nextjs-app/build/standalone/ due to the output: 'standalone' Next.js config. The Storybook stories glob was too broad and picked these up, causing webpack to fail because the copied files' relative imports couldn't resolve from inside build/standalone/."
Code changes
(I initially tried negation but this didn't work. If we ever add something like ws-nextjs-app/components then we will need to specify this here)
Testing
Useful Links