Webpack, babel and React Error message - reactjs

Out of nowhere I started getting this error message,
Invalid configuration object. Webpack has been initialised using a
configuration object that does not match the API schema.
- configuration has an unknown property 'devserver'. These properties are valid: object { amd?, bail?, cache?, context?, dependencies?,
devServer?, devtool?, entry, externals?, loader?, module?, name?,
node?, output?, performance?, plugins?, profile?, recordsInputPath?,
recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?,
target?, watch?, watchOptions? } For typos: please correct them.
For loader options: webpack 2 no longer allows custom properties in
configuration.
Loaders should be updated to allow passing options via loader options in module.rules.
Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
plugins: [
new webpack.LoaderOptionsPlugin({
// test: /.xxx$/, // may apply this only for some modules
options: {
devserver: ...
}
})
]
I have been scouring the internet for the past 2 hours trying to find a solution but I am going round in circles!
Here is my .babelrc, webpack.config.js, .js and package.json files.
Any help would be amazing. Thanks
.babelrc
{
"presets":[
"react",
["es2015", {"modules": false, "loose": true}]
]
}
package.json
{
"name": "complete-intro-to-react",
"version": "1.0.0",
"description": "A two day workshop on a complete intro to React",
"main": "index.js",
"author": "Brian Holt <btholt#gmail.com>",
"license": "MIT",
"scripts": {
"test": "NODE_ENV=test jest",
"update-test": "npm run test -- -u",
"build": "webpack",
"dev": "webpack-dev-server",
"lint": "eslint js/**/*.js webpack.config.js",
"watch": "webpack --watch"
},
"dependencies": {
"axios": "0.15.2",
"express": "4.14.0",
"history": "^4.4.0",
"lodash": "4.16.2",
"preact": "^6.4.0",
"preact-compat": "^3.9.3",
"react": "15.3.2",
"react-dom": "15.3.2",
"react-redux": "4.4.0",
"react-router": "4.0.0-alpha.5",
"redux": "3.3.1",
"redux-thunk": "^2.1.0"
},
"devDependencies": {
"babel-core": "^6.16.0",
"babel-jest": "16.0.0",
"babel-loader": "^6.2.7",
"babel-plugin-transform-es2015-modules-commonjs": "^6.18.0",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2017": "6.16.0",
"babel-preset-react": "^6.16.0",
"babel-register": "6.16.0",
"css-loader": "0.25.0",
"enzyme": "2.0.0",
"enzyme-to-json": "^1.3.0",
"eslint": "3.6.1",
"eslint-config-standard": "6.1.0",
"eslint-config-standard-jsx": "3.1.0",
"eslint-config-standard-react": "4.1.0",
"eslint-loader": "1.3.0",
"eslint-plugin-promise": "2.0.1",
"eslint-plugin-react": "6.3.0",
"eslint-plugin-standard": "2.0.0",
"jest": "15.1.1",
"jsdom": "9.5.0",
"json-loader": "0.5.4",
"react-addons-test-utils": "15.3.2",
"react-test-renderer": "15.3.2",
"style-loader": "0.13.1",
"webpack": "^2.1.0-beta.22",
"webpack-dev-server": "1.16.2"
},
"directories": {
"test": "test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/btholt/complete-intro-to-react.git"
},
"keywords": [
"react",
"workshop",
"intro",
"redux"
],
"bugs": {
"url": "https://github.com/btholt/complete-intro-to-react/issues"
},
"homepage": "https://github.com/btholt/complete-intro-to-react#readme"
}
webpack.config.js
const path = require('path')
module.exports = {
context: __dirname,
entry: './js/ClientApp.js',
devtool: 'source-map',
output: {
path: path.join(__dirname, '/public'),
filename: 'bundle.js'
},
devserver: {
publicPath: '/public/'
},
resolve: {
extensions: ['.js', '.json']
},
stats: {
colors: true,
reasons: true,
chunks: false
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
loader: 'eslint-loader',
exclude: /node_modules/
},
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
url: true
}
}
]
}
]
}
}
and the .js file
import React from 'react'
import { render } from 'react-dom'
import '../public/normalize.css'
import '../public/style.css'
const App = React.createClass({
render () {
return (
<div className='app'>
<div className="landing">
<h1>svideo</h1>
<input type="text" placeholder='search' />
<a>or Browse All</a>
</div>
</div>
)
}
})
render(<App/>, document.getElementById('app'));

Capital "S" -->devServer not devserver!

Related

React Jest - Test suite failed to run for PNG files even after adding mockFiles and identity-obj-proxy

I'm trying to Unit test my React component which imports another component that contains .png file. Because of this image, my test suits are failing to run.
I tried all the possible solutions with the below configuration, still no luck.
Please suggest, this is my project configuration.
This is my jest.config.json
{
"testRegex": "((\\.|/*.)(spec))\\.js?$"
}
My package.json
{
"name": "Application name",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --config ./webpack.config.js --mode development",
"test": "jest"
},
"jest": {
"moduleNameMapper": {
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "identity-obj-proxy"
}
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#babel/core": "^7.8.7",
"#babel/polyfill": "^7.10.1",
"#babel/preset-env": "^7.10.2",
"#babel/preset-react": "^7.8.3",
"axios-mock-adapter": "^1.18.1",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.0.6",
"css-loader": "^3.5.3",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.0",
"file-loader": "^6.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.0.1",
"prettier": "^2.0.5",
"react-hot-loader": "^4.12.19",
"redux-mock-store": "^1.5.4",
"style-loader": "^1.2.1",
"url-loader": "^4.1.0",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
},
"dependencies": {
"#material-ui/core": "^4.10.2",
"#material-ui/icons": "^4.9.1",
"#material-ui/lab": "^4.0.0-alpha.56",
"axios": "^0.19.2",
"core-js": "^3.6.5",
"d3-sankey-diagram": "^0.7.3",
"husky": "^4.2.5",
"prop-types": "^15.7.2",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-google-charts": "^3.0.15",
"react-intl": "^4.6.3",
"react-redux": "^7.2.0",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-test-renderer": "^16.13.1",
"redux": "^4.0.5",
"redux-saga": "^1.1.3",
"regenerator-runtime": "^0.13.5"
}
}
My Webpack.config.js
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: ['./src/index.js', '#babel/polyfill'],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.css$/i,
exclude: /node_modules/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
},
},
],
},
{
test: /\.(jpe?g|gif|png|svg)$/i,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
},
},
],
},
{
test: /\.(gif|png|jpe?g)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'assets/images/',
},
},
],
},
],
// loaders: [{ test: /\.jsx?$/, loader: 'babel' }],
},
devServer: {
historyApiFallback: true,
},
resolve: {
extensions: ['*', '.js', '.jsx'],
},
output: {
path: path.join(__dirname, '/dist'),
filename: 'bundle.js',
publicPath: '/',
},
plugins: [new webpack.HotModuleReplacementPlugin()],
devServer: {
contentBase: './dist',
hot: true,
},
};
My .babelrc file
{
"presets": ["#babel/preset-env", "#babel/preset-react"]
}
Finally my test file:
import React from 'react';
import Enzyme, { shallow, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import MyPackage from '../Components/index';
Enzyme.configure({ adapter: new Adapter() });
describe('Some name', () => {
it('This should be loaded', () => {
const wrapper = shallow(<MyPackage />);
const x= wrapper.find('#selector').debug();
expect(x.prop('length')).toBe(1);
});
});
I tried adding mocks/fileMock.js with
export default '';
and mocks/styleMocks.js
module.exports = {};
still I see this error -
● Test suite failed to run
D:\ReactStuff\folder\myproject\src\assets\images\mylogo.png:1
�PNG
SyntaxError: Invalid or unexpected token
1 | import React from 'react';
> 2 | import { HeaderLogo} from '../assets/images/mylogo.png';
| ^
3 |
4 | const Header = () => {
5 | return (
What am I missing here. Please suggest

Ant Design: Property 'TabPane' does not exist

Struggling to find a solution to this. I fear it's something to do with versions. However i am not excited about the prospect of downgrading, but downgrade what?
Any help would be appreciated. Please ask for any extra information.. Was not sure what else or what to show.
After running webpack;
TS2339: Property 'TabPane' does not exist on type '(...args: any[]) =>
any'.
Code main.tsx
import * as React from "react";
import { Tabs, Button, Icon } from 'antd';
const TabPane = Tabs.TabPane;
export class Main extends React.Component
{
render()
{
return (
<div className="main-container">
<div>
<Tabs>
<TabPane key="1" tab={<span><Icon type="android" />Tab1</span>}>
<div style={{ padding: '5px' }}>
Tab1
</div>
</TabPane>
<TabPane key="2" tab={<span><Icon type="android" />Tab2 </span>}>
</TabPane>
</Tabs>
</div>
</div>
);
}
}
Webpack.config.js
var createVendorChunk = require('webpack-create-vendor-chunk');
var webpack = require('webpack');
var path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const nodeExternals = require('webpack-node-externals');
module.exports = {
mode: 'development',
entry: {
ui: './src/index.tsx'
},
externals: {
"react": "React",
"react-dom": "ReactDOM",
},
devtool: 'source-map',
resolve: {
extensions: [".ts", ".tsx", ".js"]
},
output: {
path: path.resolve(__dirname, "chrome-extension/build/"),
publicPath: "build",
filename: "[name].bundle.js",
chunkFilename: '[name].bundle.js',
},
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
enforce: true,
chunks: 'all'
},
}
},
runtimeChunk: true
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css"
})
],
target: 'node', // in order to ignore built-in modules like path, fs, etc.
externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
module: {
rules: [
{
enforce: "pre",
test: /\.js$/,
loader: "source-map-loader",
},
{
test: /\.tsx?$/,
loader: "ts-loader",
exclude: /node_modules/
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"]
},
{
test: /\.less$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "less-loader",
options: {
javascriptEnabled: true
}
}]
}
],
}
};
package.json
{
"name": "test",
"version": "0.0.0",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack",
"dev": "webpack --watch"
},
"author": "Elgan",
"license": "MIT",
"devDependencies": {
"#babel/core": "^7.0.1",
"#babel/preset-env": "^7.0.0",
"#babel/preset-react": "^7.0.0",
"awesome-typescript-loader": "^5.2.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.2",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.11.1",
"css-loader": "^1.0.0",
"file-loader": "^2.0.0",
"less": "^3.8.1",
"less-loader": "^4.1.0",
"mini-css-extract-plugin": "^0.4.2",
"node-sass": "^4.9.3",
"sass-loader": "^7.1.0",
"source-map-loader": "^0.2.4",
"style-loader": "^0.23.0",
"typescript": "^3.0.3",
"webpack": "^4.19.0",
"webpack-cli": "^3.1.0",
"webpack-create-vendor-chunk": "^0.1.1",
"webpack-node-externals": "^1.7.2"
},
"dependencies": {
"#types/react": "^16.4.14",
"#types/react-dom": "^16.0.7",
"antd": "^3.9.2",
"babel": "^6.23.0",
"babel-plugin-import": "^1.9.1",
"babel-preset-env": "^1.7.0",
"classnames": "^2.2.5",
"install": "^0.12.1",
"lodash": "^4.17.11",
"npm": "^6.4.1",
"prop-types": "^15.6.2",
"react": "^16.5.1",
"react-dom": "^16.5.1",
"ts-loader": "^5.1.1"
}
}
Changing to awesome-typescript-loader seemed to help. Though not sure why, so elaboration would be useful.
I changed the TS loader from ts-loader to awesome-typescript-loader in the webpack.config.js. Then i changed the TSConfig module to commonjs. It compiled now.
webpack.config.js
{
test: /\.tsx?$/,
loader: "awesome-typescript-loader",
exclude: /node_modules/
},
tsconfig.ts
{
"compilerOptions": {
"outDir": "./dist/", // path to output directory
"sourceMap": true, // allow sourcemap support
"strictNullChecks": true, // enable strict null checks as a best practice
"module": "commonjs", // specify module code generation
"jsx": "react", // use typescript to transpile jsx to js
"target": "es5", // specify ECMAScript target version
"allowJs": true // allow a partial TypeScript and JavaScript codebase
},
"exclude": [
"node_modules"
],
}

React 16v - Uncaught TypeError: Cannot read property 'bool' of undefined

I updated my project's react version from 15.3.1 to 16.2.0. I'm getting the following runtime error message.
Uncaught TypeError: Cannot read property 'bool' of undefined
at eval (Transition.js?0efa:259)
at Object.<anonymous> (bundle.js:4059)
at __webpack_require__ (bundle.js:1337)
at fn (bundle.js:744)
at eval (398:19)
at Object.<anonymous> (bundle.js:3348)
at __webpack_require__ (bundle.js:1337)
at fn (bundle.js:744)
at eval (99:30)
at Object.<anonymous> (bundle.js:1647)
I did the update gradually and the app worked well in 15.6.2. The error started appearing after I updated it to 16.0.0. I updated it to 16.2.0 hoping it would resolve it. But no luck. My webpack.config.js and package.json is below
package.json
{
"name": "myProject",
"version": "28.0.0",
"description": "New front end",
"main": "main.js",
"scripts": {
"test": "jest",
"test-coverage": "jest --coverage",
"dev": "webpack --config webpack.config.js -d --watch",
"build": "webpack --config ./webpack.config.production.js --progress -p",
"start": "webpack-dev-server --config ./webpack.config.js --hot"
},
"repository": "",
"author": "Sarani",
"license": "BSD",
"dependencies": {
"babel": "~6.5.2",
"babel-core": "~6.13.2",
"babel-loader": "~6.2.4",
"babel-polyfill": "~6.16.0",
"babel-preset-es2015": "~6.13.2",
"babel-preset-react": "~6.11.1",
"create-react-class": "^15.6.3",
"css-loader": "~0.18.0",
"file-loader": "~0.9.0",
"isomorphic-fetch": "~2.2.1",
"json-loader": "~0.5.4",
"less": "~2.7.1",
"less-loader": "~2.2.3",
"moment-range": "~3.0.3",
"moment-timezone": "~0.5.13",
"prop-types": "^15.6.0",
"react": "^16.0.0",
"react-bootstrap": "~0.30.2",
"react-dom": "^16.0.0",
"react-redux": "~4.4.5",
"react-router": "^3.2.0",
"redux": "~3.5.2",
"redux-immutable-state-invariant": "~1.2.3",
"redux-thunk": "~2.1.0",
"style-loader": "~0.13.1",
"url-loader": "~0.5.7",
"webpack": "^3.10.0"
},
"devDependencies": {
"babel-eslint": "~6.1.2",
"babel-jest": "~14.1.0",
"eslint": "~3.5.0",
"eslint-config-airbnb": "~11.1.0",
"eslint-loader": "~1.5.0",
"eslint-plugin-import": "~1.15.0",
"eslint-plugin-jsx-a11y": "~2.2.2",
"eslint-plugin-react": "~6.2.2",
"gulp": "~3.9.1",
"gulp-csslint": "~1.0.0",
"gulp-watch": "~4.3.10",
"jest": "~14.1.0",
"jest-cli": "~14.1.0",
"react-a11y": "~0.3.3",
"react-addons-test-utils": "~15.3.2",
"react-test-renderer": "~15.3.1",
"redux-mock-store": "~1.2.1",
"webpack-dev-server": "~1.14.1"
},
"jest": {
"automock": false,
"moduleNameMapper": {
"^.+\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
"^.+\\.(gif|ttf|eot|svg)$": "<rootDir>/__mocks__/fileMock.js",
"^config$": "<rootDir>/__mocks__/configMock.js"
},
"moduleFileExtensions": [
"js",
"jsx"
]
}
}
webpack.config.js
var webpack = require('webpack');
var path = require('path');
module.exports = {
devtool: 'eval-source-map',
entry: {
bundle: ['babel-polyfill', './Main.js'],
bundleIntegrated: ['babel-polyfill', './MainIntegrated.js']
},
output: {
path: path.resolve(__dirname, '../assets/myProject'),
filename: '../assets/myProject/[name].js'
},
target: 'web',
devServer: {
inline: true,
port: 8080,
proxy: {
'/myct/**': {
target: 'http://localhost:9000',
secure: false,
changeOrigin: true
}
}
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin()
],
resolve: {
extensions: ['.js', '.jsx'],
alias: {
config: path.join(__dirname, 'config/config.dev')
}
},
module: {
rules: [
{
test: /.(js|jsx)$/,
enforce: 'pre',
exclude: /node_modules/,
use: [
{
loader: "eslint-loader",
}
],
},
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|__tests__)/,
loader: "babel-loader",
},
{
test: /\.css$/,
use: [
"style-loader",
"css-loader",
],
},
{
test: /\.less$/,
use: [
"style-loader",
"css-loader",
"less-loader",
],
},
{
test: /\.woff($|\?)|\.woff2($|\?)|\.ttf($|\?)|\.eot($|\?)|\.svg($|\?)/,
use: [
{
loader: "file-loader?name=../assets/myProject/fonts/[name].[ext]",
},
],
},
]
}
}
Any ideas on how to fix this issue. Thanks in advance :)
I had the same issue.
If you run yarn info react-bootstrap peerDependencies, you will see the following:
{
react: '>=16.8.0',
'react-dom': '>=16.8.0'
}
So, make sure the versions are correct.
I've fixed it by running yarn add react#latest and also yarn add react-dom#latest. In addition, I set react-bootstrap to 0.32.4, as version 1.0.0 threw different errors.
"react": "^16.13.1",
"react-bootstrap": "0.32.4",
"react-dom": "^16.13.1",
Thank you all for your help. I managed to fix the issue by updating the following to latest versions. The solution can be found here
"react": "latest",
"react-dom": "latest",
"react-bootstrap": "latest",
"react-router-dom": "latest"

Webpack producing no input

I am aware that this is quite a common problem with Webpack, but I am a total newbie and the solutions I've found so far seem to be very specific to the single project. However, the scenario is the same: Webpack compiling the project correctly and then showing a blank page, without reporting any errors.
Here is my webpack.config.js (I made it following tutorials):
import path from 'path';
import HtmlWebpackPlugin from 'html-webpack-plugin';
export default () => ({
entry: [
path.join(__dirname, 'src/index.jsx'),
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './App.html'
}),
],
module: {
rules: [
{
test: /.jsx?$/,
exclude: /node_modules/,
include: path.join(__dirname, 'src'),
use: [
{
loader: 'babel',
options: {
babelrc: false,
presets: [
['es2015', { modules: false }],
'react',
],
}
}
]
},
{
test: /\.(css|scss|sass)$/,
loader: 'style!css!sass',
},
]
},
});
module.exports = config;
Here my package.json:
{
"name": "smart-fit",
"version": "1.0.0",
"description": "",
"main": "src/index.js",
"dependencies": {
"chartjs": "^0.3.24",
"interactjs": "^1.2.8",
"jquery": "^3.2.1",
"lodash": "^4.17.4",
"moment": "^2.18.1",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"react-hot-loader": "^3.0.0-beta.3",
"react-table": "^5.6.0"
},
"devDependencies": {
"babel-core": "^6.24.1",
"babel-loader": "^6.4.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-register": "^6.24.1",
"css-loader": "^0.28.1",
"extract-text-webpack-plugin": "^2.0.0-beta.4",
"html-webpack-plugin": "^2.28.0",
"loader-utils": "^1.1.0",
"node-sass": "^4.5.2",
"sass-loader": "^6.0.3",
"style-loader": "^0.17.0",
"webpack": "^2.1.0-beta.25",
"webpack-dev-server": "^2.1.0-beta.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Webpack version is the lastest and the project is written using React and ES5.

Use of spread operator (...) with React and Redux

I am building a react app with Redux. I have a reducer returning:
const posts = (state={posts:[], search_criterion:''}, action) => {
switch (action.type) {
case 'SOME_EVENT':
return {
...state,
search_criterion:action.search_criterion
}
default:
return state
}
}
export default posts
When I build with Webpack, I get:
Module build failed: SyntaxError: Unexpected token (x:y)
Which points to ....
Any idea? What am I doing wrong?
webpack.config.js
const webpack = require('webpack');
module.exports = {
context: __dirname + "/app",
entry: {
javascript: "./app.js"
// ,html: "./index.html",
},
output: {
filename: "app.js",
path: __dirname + "/server/js",
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.html$/,
loader: "file?name=[name].[ext]",
},
],
},
//alient app settings settings
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('test'),
'APIHOST': JSON.stringify('http://localhost:8081'),
}
})
],
}
package.json
{
"name": "react-project",
"version": "1.0.0",
"description": "",
"main": "app.js",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --config ./webpack.config.js",
"start": "NODE_ENV=test APIHOST=http://localhost:8081 babel-node server/server.js --presets es2015,stage-2"
},
"babel": {
"presets": [
"es2015",
"react"
]
},
"author": "",
"license": "ISC",
"devDependencies": {
"axios": "^0.15.2",
"babel": "^6.5.2",
"babel-cli": "^6.18.0",
"babel-core": "^6.18.2",
"babel-loader": "^6.2.7",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-2": "^6.18.0",
"body-parser": "^1.15.2",
"express": "^4.14.0",
"express-handlebars": "^3.0.0",
"express-session": "^1.14.2",
"file-loader": "^0.9.0",
"node-jsx": "^0.13.3",
"socket.io": "^1.5.1",
"uglify-js": "^2.7.4",
"webpack": "^1.13.3",
"webpack-dev-server": "^1.16.2"
},
"dependencies": {
"react": "^15.4.0",
"react-dom": "^15.4.0",
"react-redux": "^4.4.6",
"redux": "^3.6.0",
"redux-logger": "^2.7.4",
"redux-thunk": "^2.1.0"
}
}
In your package.json add stage-0 under react, like so:
"babel": {
"presets": [
"es2015",
"react"
"stage-0"
]
},
Alternatively you could just add the transform-object-rest-spread plugin.

Resources