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

Migrate webpack configuration in 5.x #6081

Closed
3 of 4 tasks
shilman opened this issue Mar 14, 2019 · 10 comments
Closed
3 of 4 tasks

Migrate webpack configuration in 5.x #6081

shilman opened this issue Mar 14, 2019 · 10 comments

Comments

@shilman
Copy link
Member

shilman commented Mar 14, 2019

We changed the webpack configuration API between 4.x and 5.x. Although we documented this change in MIGRATION.md, we didn't anticipate the chaos this change would cause, including:

There are probably more issues that we don't know about yet.

Discussed a path forward with @tmeasday and documenting this as an umbrella issue:

Deprecating extend mode

Extend mode is "magic" behavior that obscures customization without providing enough added value to justify its existence. It's also another code path and another source of confusion in documentation / mental model / etc. Instead we should encourage people to use full-control mode and make that as convenient as possible.

@shilman
Copy link
Member Author

shilman commented Mar 14, 2019

A simpler option would be to restore baseConfig to full-control mode. @igor-dv @ndelangen @tmeasday what do you think about this?

@ndelangen
Copy link
Member

I think storybook's CLI (start & build commands) should create a .log file when a problem is detected or someone passes --debug it them.

This log can then be used to output things like the full webpack config.

Before storybook actually starts we should do some final analysis of the webpack config for common known issues. (things like double loaders, double plugins, removal of storybook entrypoints)

Also we want to create presets for the things most people are writing custom webpack config for.

@shilman
Copy link
Member Author

shilman commented Mar 15, 2019

OK debugged this with @ndelangen. There was a regression in SB5 for webpack "extend mode" which caused the issues here. In 4.x extend-mode operated on baseConfig and in 5.0 it operated on the defaultConfig.

Here is the diff in output between v4 and v5 extend configs (red is v4, green is v5): https://gist.github.com/shilman/5ce0d26a77d2774b13d30f7f346b93d5/revisions

What we're going to do:

  • Restore the old behavior to unbreak people
  • Deprecate extend-mode as previously discussed

Adding this to #6104 now!

@tmeasday
Copy link
Member

Aha! Good work!

@shilman
Copy link
Member Author

shilman commented Mar 16, 2019

Olé!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-alpha.7 containing PR #6082 that references this issue. Upgrade today to try it out!

Because it's a pre-release you can find it on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Mar 16, 2019
@shilman shilman reopened this Mar 16, 2019
@shilman
Copy link
Member Author

shilman commented Mar 17, 2019

Whoopee!! I just released https://github.com/storybooks/storybook/releases/tag/v5.0.2 containing PR #6082 that references this issue. Upgrade today to try it out!

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Mar 17, 2019
@elie222
Copy link

elie222 commented Mar 17, 2019

Still having issues importing SVGs.

@shilman
Copy link
Member Author

shilman commented Mar 18, 2019

@elie222 i added a --debug-webpack CLI flag so you can see the final preview webpack config. How many rules do you have that match SVG?

@shilman
Copy link
Member Author

shilman commented Mar 18, 2019

@jacobgranberry are you using 5.0.2? Also do you need to run with -- --debug-webpack (it used to be that way in npm -- I use yarn now)?

@jacobgranberry
Copy link

@shilman the extra dashes worked. sorry, still new to this. thank you for the quick response!

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

No branches or pull requests

5 participants