fetch method is not defined using ES6 fetch in React
<p>I have a trouble with fetch functions in my first react js app.</p>

<p>This is the structure of my project:</p>

<pre><code>hello-world
  -- app
     -- components
       -- main.jsx
  -- node_modules
  -- public
     -- build.js
     -- index.html
  -- package.json
</code></pre>

<p>This is what I've installed using npm:</p>

<pre><code>npm install react react-dom babel-core babel-loader babel-preset-es2015    babel-preset-react webpack --save-dev
npm install --save isomorphic-fetch es6-promise
</code></pre>

<p>I use webpack
webpack.config</p>

<pre><code>module.exports = {
  entry: './app/components/main.jsx',
  output: {
    path: './public/',
    filename: "build.js",
  },
  module: {
    loaders: [
      {
        exclude: /(node_modules|bower_components)/,
        loader: 'babel',
        query: {
          presets: ['es2015', 'react']
        }
      }
    ]
  }
};
</code></pre>

<p>package.json</p>

<pre><code>{
  "name": "hello-world",
  "version": "1.0.0",
  "description": "",
  "main": "webpack.config.js",
  "scripts": {
    "build": "webpack -w"
  },
  "author": "mannuk",
  "license": "MIT",
  "devDependencies": {
    "babel-core": "^6.14.0",
    "babel-loader": "^6.2.5",
    "babel-preset-es2015": "^6.14.0",
    "babel-preset-react": "^6.11.1",
    "react": "^0.14.8",
    "react-dom": "^0.14.8",
    "webpack": "^1.13.2"
  },
  "dependencies": {
    "es6-promise": "^3.3.1",
    "isomorphic-fetch": "^2.2.1"
  }
}
</code></pre>

<p>This is the file where I build the UI:</p>

<p>main.jsx</p>

<pre><code>import React from 'react';
import ReactDOM from 'react-dom';
import 'isomorphic-fetch';
import 'es6-promise';

class Person extends React.Component {

  constructor(props){
    super(props);
    this.state = {people : []};
  }

  componentWillMount(){
    fetch('xxx/people',
      method: 'get',
      headers: {'token' : 'xxx'}
      )
      .then((response) =&gt; {
        return response.json()
      })
      .then((people) =&gt; {
        this.setState({ people: people })
      })
  }

  render(){
    return &lt;div&gt;
        &lt;input type="text" value={this.state.people[0].name}&gt;&lt;/input&gt;
      &lt;/div&gt;
  }
}

ReactDOM.render(
  &lt;Person/&gt;,
  document.getElementById('container')
);
</code></pre>

<p>If I try to run it through the browser it fails (fetch method is not defined) I have also checked this releated post <a href="https://stackoverflow.com/questions/36484156/es6-fetch-is-undefined">ES6 `fetch is undefined`</a> and I have included the import with no success. I also included es6-promise import but it fails too.</p>

<p>What am I doing wrong? Is it a config problem or what? When I run 'npm run build' there is no error and the build.js seems to be ok.</p>