Skip to content
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

feat(storybook): add Webpack 5 support for React Storybook setups #6791

Merged
merged 2 commits into from
Oct 9, 2021

Conversation

juristr
Copy link
Member

@juristr juristr commented Aug 20, 2021

Current Behavior

Right now, React with Webpack 5 is just an opt-in, which is also why the current Storybook generator doesn't use the Webpack 5 setup by default.

Expected Behavior

This PR adds two things:

a) a warning if an existing Storybook configuration doesn't use the Webpack 5 configuration

image

b) Detects whether the React setup uses Webpack 5 and makes sure to generate proper Webpack 5 setup for Storybook react stories

Newest changes:

User migrates to Webpack 5

User uses this guide.
When they run

npx nx g @nrwl/web:webpack5

to migrate their React projects, this generator will also do the following:

  1. Check if they have the @storybook/react package installed
  2. It will install @storybook/builder-webpack5 and @storybook/manager-webpack5 if they are not already installed
  3. It will add the builder: 'webpack5' option in the Storybook configurations (.storybook/main.js) of their React projects

Related Issue(s)

Fixes #6703

@vercel
Copy link

vercel bot commented Aug 20, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nrwl/nx-dev/HaVhNM588mF25sEoUhuSxEVFaRNu
✅ Preview: Canceled

[Deployment for 6c5dd73 canceled]

@juristr juristr linked an issue Aug 20, 2021 that may be closed by this pull request
@juristr juristr force-pushed the detect-storybook-react-webpack5 branch from e2b083a to 534ec40 Compare August 20, 2021 15:02
@juristr juristr changed the title feat(storybook): detect when React uses Webpack 5 but Storybook isn't and add link to migration guide feat(storybook): add Webpack 5 support for React Storybook setups Aug 20, 2021
@juristr juristr marked this pull request as ready for review August 20, 2021 15:40
@juristr juristr requested a review from jaysoo August 20, 2021 16:17
@juristr juristr marked this pull request as draft September 3, 2021 06:58
@mandarini mandarini force-pushed the detect-storybook-react-webpack5 branch from 61af2a1 to 38f4c08 Compare October 1, 2021 13:26
@mandarini mandarini force-pushed the detect-storybook-react-webpack5 branch from 38f4c08 to 34e062a Compare October 1, 2021 14:52
@mandarini mandarini force-pushed the detect-storybook-react-webpack5 branch from 34e062a to 1fe6b18 Compare October 1, 2021 14:53
@mandarini mandarini force-pushed the detect-storybook-react-webpack5 branch from 1fe6b18 to d5de774 Compare October 1, 2021 16:41
@mandarini mandarini force-pushed the detect-storybook-react-webpack5 branch from d5de774 to dc9070b Compare October 1, 2021 16:53
@mandarini mandarini force-pushed the detect-storybook-react-webpack5 branch from dc9070b to e517946 Compare October 1, 2021 18:07
@mandarini mandarini force-pushed the detect-storybook-react-webpack5 branch from e517946 to b985331 Compare October 1, 2021 18:23
@mandarini mandarini marked this pull request as ready for review October 1, 2021 19:00
@mandarini mandarini added scope: react Issues related to React support for Nx scope: storybook Issues related to Storybook support in Nx labels Oct 1, 2021
@mandarini mandarini force-pushed the detect-storybook-react-webpack5 branch from b985331 to 2702e09 Compare October 4, 2021 09:11
@jaysoo jaysoo merged commit c446aa5 into master Oct 9, 2021
@jaysoo jaysoo deleted the detect-storybook-react-webpack5 branch October 9, 2021 01:51
@jaysoo
Copy link
Member

jaysoo commented Oct 9, 2021

Need this for the webpack upgrade. Merging it and removing the isWebpack5 checks :)

#7283

@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
scope: react Issues related to React support for Nx scope: storybook Issues related to Storybook support in Nx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

React "build-storybook" fails in v12.7.0 and Webpack5
4 participants