help wanted: Using javascript generator

0
open
JeanOsorio
JeanOsorio
Posted 4 years ago

help wanted: Using javascript generator #1328

I trying to use js generator, but I always get:

`✖ Webpack compiler encountered errors. ./src/routes/Home/components/HomeContainer.js Module build failed: SyntaxError: Unexpected token (190:11)

188 | } 189 |

190 | function * foo (x) { | ^ 191 | var y = 2 * (yield (x + 1)); 192 | var z = yield (y / 3); 193 | return (x + y + z);

BabelLoaderError: SyntaxError: Unexpected token (190:11)

188 | } 189 |

190 | function * foo (x) { | ^ 191 | var y = 2 * (yield (x + 1)); 192 | var z = yield (y / 3); 193 | return (x + y + z);

at transpile (/Users/jean/Repos/analytics/tableau-wdc/tableau-wdc/node_modules/babel-loader/lib/index.js:64:13)
at /Users/jean/Repos/analytics/tableau-wdc/tableau-wdc/node_modules/babel-loader/lib/fs-cache.js:118:18
at ReadFileContext.callback (/Users/jean/Repos/analytics/tableau-wdc/tableau-wdc/node_modules/babel-loader/lib/fs-cache.js:31:21)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:359:13)

@src/routes/Home/index.js 22:0-55 @src/routes/index.js @src/main.js @multi ./src/main webpack-hot-middleware/client.js?path=/__webpack_hmr ✖ Compiler encountered errors. Error: Webpack compiler encountered errors`

I'm trying to follow the other two question: https://github.com/davezuko/react-redux-starter-kit/issues/588 https://github.com/davezuko/react-redux-starter-kit/issues/546

but I can't make it work.