react-webpack-generators / generator-react-webpack-alt Goto Github PK
View Code? Open in Web Editor NEWReact Webpack Generator including Alt.js support
License: MIT License
React Webpack Generator including Alt.js support
License: MIT License
When I try use spread operator, simple code:
import alt from 'components/Dispatcher';
class NotificationActions {
send(notification) {
return notification;
}
success(n) {
this.send({
level: 'success',
...n
});
}
error(n) {
this.send({
level: 'error',
...n
});
}
warning(n) {
this.send({
level: 'warning',
...n
});
}
info(n) {
this.send({
level: 'info',
...n
});
}
}
export default alt.createActions(NotificationActions);
Error:
./src/actions/NotificationActions.js
Module build failed: SyntaxError: /Users/cezarluiz/Documents/Web/gobiker-cms/src/actions/NotificationActions.js: Unexpected token (10:9)
8 |
9 | success(n) {
> 10 | let {...obj} = n;
| ^
11 |
12 | console.log(obj);
13 | }
at Parser.pp.raise (/Users/cezarluiz/Documents/Web/gobiker-cms/node_modules/babylon/lib/parser/location.js:22:13)
at Parser.pp.unexpected (/Users/cezarluiz/Documents/Web/gobiker-cms/node_modules/babylon/lib/parser/util.js:91:8)
at Parser.pp.parseIdentifier (/Users/cezarluiz/Documents/Web/gobiker-cms/node_modules/babylon/lib/parser/expression.js:1009:10)
at Parser.pp.parsePropertyName (/Users/cezarluiz/Documents/Web/gobiker-cms/node_modules/babylon/lib/parser/expression.js:831:135)
at Parser.pp.parseObj (/Users/cezarluiz/Documents/Web/gobiker-cms/node_modules/babylon/lib/parser/expression.js:747:12)
at Parser.pp.parseBindingAtom (/Users/cezarluiz/Documents/Web/gobiker-cms/node_modules/babylon/lib/parser/lval.js:161:19)
at Parser.pp.parseVarHead (/Users/cezarluiz/Documents/Web/gobiker-cms/node_modules/babylon/lib/parser/statement.js:581:18)
at Parser.<anonymous> (/Users/cezarluiz/Documents/Web/gobiker-cms/node_modules/babylon/lib/plugins/flow.js:957:13)
at Parser.parseVarHead (/Users/cezarluiz/Documents/Web/gobiker-cms/node_modules/babylon/lib/plugins/flow.js:957:13)
at Parser.pp.parseVar (/Users/cezarluiz/Documents/Web/gobiker-cms/node_modules/babylon/lib/parser/statement.js:564:10)
@ ./src/components/Main.js 23:27-65onSocketMsg.errors @ client:44sock.onmessage @ client:79EventTarget.dispatchEvent @ eventtarget.js:49(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:44WebSocketTransport.ws.onmessage @ websocket.js:35
This is a cross post from my redux generator but also affects this generator.
Fix is quite simple.
Let me know If I should supply a PR.
Hi, when I generate a new component, the import comes `import React from 'react/addons';``
Error:
Warning: require('react/addons') is deprecated. Access using require('react-addons-{addon}') instead.
Remove /addons resolves.
Hello,
Do you know if there is a known issue about Alt IE9/10 support?
Here's my situation:
I created a basic application based on your generator and I implemented a first actions/store structure. Everything is going right when testing under Chrome: I'm able to bind my action to my store. This is not the case under IE9/10: the bound method in the store is not called, with no error message.
Any ideas? Thx.
hi @weblogixx, I just tried to install the generator from a local copy and noticed that
$ yo ./node_modules/generator-react-webpack-alt
triggers generators/action/index.js
. When settingmain
in package.json
to generators/app/index.js
the local install works. If that change doesn't break other behavior it might be worth an update.
I created a clean project using the generator.
then, npm install --save react-router redux-simple-router
but couldn't render components using Routes.
I changed run.js to render the routes:
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={SearchComponent}/>
</Route>
</Router>
</Provider>
Modified reducers/index.js to combine the routeReducer:
import { combineReducers } from 'redux';
import { routeReducer } from 'redux-simple-router'
/* Populated by react-webpack-redux:reducer */
const reducers = { routing: routeReducer, search: require('../reducers/search.js') };
module.exports = combineReducers(reducers);
and added Router.RouteHandler
to render under Main.js (AppComponent).
but I keep getting these two errors:
Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of AppComponent
.
Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of AppComponent
.
Thanks in advanced
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.