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

Missing dependencies of 'react-css-modules' #287

Closed twang2218 closed 7 years ago

twang2218 commented 7 years ago

After I create a Component for a newly generated project, and npm run test, I got this error:

ERROR in ./src/components/Header.js
Module not found: Error: Can't resolve 'react-css-modules' in '/Users/taowang/lab/shui-device/shui-device-server/dashboard/src/components'
 @ ./src/components/Header.js 32:275-303
 @ ./test/components/HeaderTest.js
 @ ./test (Test\.js$)
 @ ./test/loadtests.js
13 09 2016 00:49:59.918:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket /#ESqloRC_nto7oG8jAAAA with id 32856312
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
  Error: Cannot find module "react-css-modules"
  at webpack:///components/Header.js:9:1611 <- test/loadtests.js:31416

And I double checked the package.json, there isn't any react-css-modules dependencies.

Here is what I choose when I generate the project:

? Please choose your application name 'dashboard'
? Which style language do you want to use? scss
? Enable css module support? See https://github.com/gajus/react-css-modules
 for further info: Yes
? Enable postcss? No

I was using generator-react-webpack-redux, however, it depends generator-react-webpack for the basic stuff, that's the reason I think this bug should reported here.

Here is the generators versions:

├─┬ generator-react-webpack-redux@1.0.2
│ ├─┬ generator-react-webpack@4.0.1-1
weblogixx commented 7 years ago

Hi @twang2218,

this seems kind of strange. It seems that the redux generator does not call the write action correctly. I will have a look at it and report back.

sthzg commented 7 years ago

Hi @weblogixx. Just a quick double-check. Did we release a new beta after adding in https://github.com/react-webpack-generators/generator-react-webpack/commit/b581e5bd021da0ca2871a27d66bbcd9279887c63? I think the latest ist from June, 30th, so it might be that this commit isn't yet packaged to npm.

weblogixx commented 7 years ago

Indeed, thats a good question. Will have a look at it, maybe I really forgot to publish :(.

sthzg commented 7 years ago

I've checked that we don't have this bug on master and fixed another bug related to testing components created with css modules in the template repository. In the next days there will be a fix available for the PostCSS part of the installer. I'd say that will be the perfect time to publish the next pre-release of V4 (users of our generator wouldn't run into this except installing beta or the master branch directly, but as the Redux gen bases itself on our V4 they encounter these problems directly).

I am closing this for now, but feel free to comment on the issue if there are further requests.