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

Missing support for webpack2 config with rules #292

Closed
avaly opened this issue Jan 25, 2017 · 2 comments
Closed

Missing support for webpack2 config with rules #292

avaly opened this issue Jan 25, 2017 · 2 comments

Comments

@avaly
Copy link

avaly commented Jan 25, 2017

Using webpack2 with a custom config which uses module.rules instead of module.loaders fails to load.

The issue is due to webpack loading either rules or loaders, but not both: https://github.com/webpack/webpack/blob/v2.2.0/lib/NormalModuleFactory.js#L46

And react-styleguidist only exports loaders: https://github.com/styleguidist/react-styleguidist/blob/master/scripts/make-webpack-config.js#L82

See demo: https://github.com/avaly/react-styleguidist-example/tree/webpack2-rules

@sapegin
Copy link
Member

sapegin commented Jan 25, 2017

It shouldn’t be a problem in the 5.0.0 beta. Could you please try it?

https://github.com/styleguidist/react-styleguidist/releases/tag/5.0.0%40beta.9

@avaly
Copy link
Author

avaly commented Jan 25, 2017

Indeed, it does work with the latest beta: styleguidist/example#2

As a workaround for folks who are on react-styleguidist <=4.* :

updateWebpackConfig(webpackConfig, env) {
  webpackConfig.module.rules = webpackConfig.module.loaders.concat([
    // your custom rules here
  ]);
  webpackConfig.module.loaders = [];
  return webpackConfig;
}

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

No branches or pull requests

2 participants