Skip to content

NextJS: Turn withStorybook into ergonomic module export#25027

Merged
shilman merged 3 commits into
shilman/nextjs-server-mockfrom
shilman/nextjs-default-export-config
Nov 29, 2023
Merged

NextJS: Turn withStorybook into ergonomic module export#25027
shilman merged 3 commits into
shilman/nextjs-server-mockfrom
shilman/nextjs-default-export-config

Conversation

@shilman
Copy link
Copy Markdown
Member

@shilman shilman commented Nov 29, 2023

This is a little cleaner in your next.config.js and matches what other NextJS plugins are doing

Testing

Update your next.config.js to:

const withStorybook = require('@storybook/nextjs-server/next-config')();
module.exports = withStorybook({ /* existing nextjs config */ });

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

Copy link
Copy Markdown
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

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

Sure. Do we need to make the cts change? Wasn't it working before? No stress either way

@shilman
Copy link
Copy Markdown
Member Author

shilman commented Nov 29, 2023

@tmeasday No, when it's .ts you need to do this AFAICT, which sucks. There might be a better way around it, but .cts works cc @valentinpalkovic

const withStorybook = require('...').default();

@shilman shilman marked this pull request as ready for review November 29, 2023 06:28
@shilman shilman merged commit d63baba into shilman/nextjs-server-mock Nov 29, 2023
@shilman shilman deleted the shilman/nextjs-default-export-config branch November 29, 2023 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants