Answer the question
In order to leave comments, you need to log in
How to create an empty NodeJS backend application with WebPack + ReactJS + ES6 support?
Friends, please share an example that will serve as the foundation for a ReactJS + ES6 application that can be built using WebPack.
I need to write a simple WebSocketServer, ...no problem, but I DO NOT want to do it like in the clumsy ES5 times.
Unable to create project skeleton (WebStorm IDE).
I would like to write classes as in the usual FrontEnd.
Actually, the problem is that it is not clear what should be in package.json and how to set up WebPack.config.js so that it simply launches my ReactJS + ES6 application initialization class, from which I could start further.
Answer the question
In order to leave comments, you need to log in
You don't really need webpack to support react in nodejs. Install babel, then make a server-side entry point like https://github.com/erikras/react-redux-universal-h...
// enable runtime transpilation to use ES6/7 in node
var fs = require('fs');
var babelrc = fs.readFileSync('./.babelrc');
var config;
try {
config = JSON.parse(babelrc);
} catch (err) {
console.error('==> ERROR: Error parsing your .babelrc.');
console.error(err);
}
require('babel-register')(config);
I'm not a real welder on react, but this thing has been in the public eye lately: https://github.com/zeit/next.js. It looks quite convenient (well, how convenient it can be on the react).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question