Open Primajin opened 8 years ago
Same Problem seems to be for actions aswell. It starts to link files, but then fails somewhere and leaving behind files that are linked but do not exist and so on :(
Give me a couple of days to look into this, might have to do with ast parsing.
Any update on this issue?
I'm adding the routerReducer as the first obj pair in src/reducers/index.js
for the time being. The yo command still fails but src/reducers/index.js
still populates correctly from me.
0 import { combineReducers } from 'redux';
1 import { routerReducer } from 'react-router-redux';
2 /* Populated by react-webpack-redux:reducer */
3 const reducers = {
4 routing: routerReducer
5 };
6 module.exports = combineReducers(reducers);
Alright, this seems to be multiple issues at once.
The spread operator ... seems to be a problem when parsing the abstract syntax tree. So @Primajin instead of
module.exports = combineReducers({...reducers, routing: routerReducer});
simply add the router reducer to the reducers like @juegas does. On my side the parser throws an error regarding this - strange that it does not on your side. Could you maybe tell me more about your system: OS, node and npm version?
After adding the router reducer like so, I have absolutely no problems adding reducers / actions.
@juegas which yo command fails on your side exactly?
Could any of you share their project, so I can take a look? I tried re creating the issue from a fresh setup from the master branch and everything is working as it should. So I can not reproduce the issue on my side:
yo react-webpack-redux
npm install --save react-router-redux
// import in ./src/reducers/index.js
// add router reducer to reducers as 1st item
yo react-webpack-redux:reducer test_1
yo react-webpack-redux:action test_1
Allright, I have this on my machine at work and will give you all the infos as soon as I'm back in the office tomorrow morning (CEST)
yo:Action is adjusting ./actions/const.js && ./containers/App.js
and creating ./actions/name.js
yo:Reducer is failing silently. It is successfully adding name: require('../reducers/name.js')
to ./reducers/index.js
but then fails creating the reducer & test files.
@stylesuxx OK after adding the router reducer like you guys suggested it works as expected.
It does not fail for me anymore, but if it does, it does it silently and leaves back half way created files which is not so cool. So at least that would be great to get rid of.
I'm on a MBP with latest OSX. NPM is 3.8.6, Node is 5.11.1
I'm also on an MBP with the latest OSX NPM is 3.9.5, Node is 4.0.0
OK, so both on you are on mac. Interesting. I am on Linux and get an error -_- will be awesome to debug :-D I guess I should be able to get rid of it when I change AST parsing to acorn, but right now I have not enough time to dive into that.
So @Primajin is good now as I understand.
@juegas you are still experiencing problems?
@stylesuxx well yea the issue remains but it doesn't block me from my experimentations with react-rout + redux-router.
gl looking into it and thanks
So I was using the
yo react-webpack-redux:reducer myReducer
command with no problems. Since you suggested using react-router-redux, I implemented it into myreducer/index.js
with a simple import ofimport { routerReducer } from 'react-router-redux';
and changed the last line frommodule.exports = combineReducers(reducers);
to
module.exports = combineReducers({...reducers, routing: routerReducer});
When I now try to run the yo command it fails silently. Changing the last line back to what it was before while leaving the (now unused) import inside the file - and the command works again.
Now what I find very curious about is, that this line does not change when adding new reducers, and thus should not cause the generator to fail nor should it fail silently like this.
Let me know if you need any more information. Cheers