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

CLI: Add webpack4/5 detection #17908

Merged
merged 7 commits into from Apr 7, 2022

Conversation

ndelangen
Copy link
Member

What I did

The CLI can now detect which version of webpack you are using. If it detects you have webpack version 4 installed anywhere, it will use builder-webpack4, if you do not, and you have webpack v5 installed instead, it will use builder-webpack5.

It will still default to use builder-webpack4 if it can't detect anything.

I also added the builder-webpack4 and manager-webpack4 in the case the builder is indeed webpack4. Seems like the right thing to do, if we don't want core-server to depend on any builder in particular.

@nx-cloud
Copy link

nx-cloud bot commented Apr 6, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 8ef8085. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@shilman shilman changed the title improve webpack4-5 detection in CLI CLI: Add webpack4-5 detection Apr 7, 2022
@shilman shilman changed the title CLI: Add webpack4-5 detection CLI: Add webpack4/5 detection Apr 7, 2022
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Great job @ndelangen 💯

@shilman shilman merged commit f88c938 into next Apr 7, 2022
@shilman shilman deleted the norbert/sb-238-cli-autodetect-webpack45-on-sb-init branch April 7, 2022 02:51
@ndelangen
Copy link
Member Author

😎

@daniel-stoian-lgp
Copy link

How can I set which webpack version I want storybook to use after this update?

@shilman
Copy link
Member

shilman commented May 7, 2022

@daniel-stoian-lgp you can set the core.builder property in main.js:

https://storybook.js.org/docs/6.5/react/configure/webpack#webpack-5

cc @jonniebigodes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants