react-webpack-generators / generator-react-webpack

Yeoman generator for ReactJS and Webpack
http://newtriks.com/2013/12/31/automating-react-with-yeoman-and-grunt/
MIT License
2.88k stars 355 forks source link

Configuring Webpack loaders for CSSModules + Preprocessor #248

Closed sthzg closed 8 years ago

sthzg commented 8 years ago

Probably belongs to the template repo

After installing the 4.x generator with CSSModules + Preprocessor (e.g. LESS) and creating a new component the component template creates

- Foobar.js
- foobar.cssmodule.less
import styles from './foobar.cssmodule.less';
// ...
<div className="foobar-component" styleName="foobar-component" />

Rendering will fail with an exception of css module is undefined, because the loaders in cfg/base are configured for for the *.less files only and miss a test against *.cssmodule.less and a loader that is adapted for cssmodules ('css?modules&importLoaders=1&localIdentName=[name]-[local]-[hash:base64:5]').

sthzg commented 8 years ago

Moved to https://github.com/weblogixx/react-webpack-template/issues/32