A starter project for react-server-app, if you don't familiar with React with Webpack, the following links is highly recommended.
please use the latest version of following tools:
-
babel-node
is selected in the server-side, which is an executable for running code via Babel that otherwise works like thenode
executable. -
babel-preset-es2015
is selected, so that Babel can transpile ES6. The preset configures Babel so that only ES6 constructs are transpiled that missing from Node.js 5。
Tools:
- webpack as a client-side module build and module loader
- npm as the package manager
- Babel as a transpiler from ES6 to ES5
Dependencies:
babel-loader
enables webpack to transpile JavaScript via Babel.babel-preset-es2015
is a Babel preset for compiling ES6 to plain ES6.webpack-dev-server
adds a hot-reloading development web server to webpack.
npm install
If your app is ready, and you want to check the results, you can execute
npm run dev
then the bundle.js
(rename 'index.js') is serving at http://localhost:9000/js/index.js
via your koa server,
remember!!! you should modify the path of file index.js
in layout.jsx
manually!
watch app.js and restart node server
npm install -g supervisor
npm start
Open your browser, and visit http://localhost:3000
to check the result