Skip to content

WS-NA: Makes nextjs storybook path explicit - #14241

Open
Isabella-Mitchell wants to merge 3 commits into
latestfrom
WS-NA-storybook-fix
Open

WS-NA: Makes nextjs storybook path explicit#14241
Isabella-Mitchell wants to merge 3 commits into
latestfrom
WS-NA-storybook-fix

Conversation

@Isabella-Mitchell

@Isabella-Mitchell Isabella-Mitchell commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

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

  • Limits Storybook stories glob to only include pages (automatically exlcuding build)

(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

  1. Make a build inside the ws-nextjs-app using a build command, e.g. yarn build:live
  2. Run storybook locally using yarn storybook

Useful Links

@Isabella-Mitchell Isabella-Mitchell changed the title WS-NA: Fix storybook after running build command WS-NA: Exclude build from storybook glob Jul 21, 2026
@Isabella-Mitchell Isabella-Mitchell changed the title WS-NA: Exclude build from storybook glob WS-NA: Makes nextjs storybook path explicit Jul 21, 2026
@Isabella-Mitchell
Isabella-Mitchell marked this pull request as ready for review July 21, 2026 08:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-app from the whole app to only ws-nextjs-app/pages/**, implicitly excluding build output.
  • Keeps existing Storybook story discovery for the legacy and src/app areas unchanged.

Comment thread .storybook/main.ts
'./DocsDecorator/**/*.stories.@(t|j)sx',
'./StorybookComponents/**/*.stories.@(t|j)sx',
'../ws-nextjs-app/**/*.stories.tsx',
'../ws-nextjs-app/pages/**/*.stories.tsx',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants