title: Getting ReferenceError: Can't find variable: require react webpack?
body: <p>Creating email sending option from font-end with gmail-send (<a href="https://www.npmjs.com/package/gmail-send#code-example" rel="nofollow">https://www.npmjs.com/package/gmail-send#code-example</a>) nom module. While implementing this i'm getting this issue 'ReferenceError: Can't find variable: require'. Is there i missed on web-pack-config.js?</p>
  
  <p>Here is my webpack config.js code,</p>
  
  <pre><code>var webpack = require('webpack');
  var LiveReloadPlugin = require('webpack-livereload-plugin');
  
      module.exports = {
          target: 'node',
          entry:['./src/custom-script.js', './src/main.js'],
          output: {
            path: __dirname,
            filename: "build/bundle.js"
          },
          resolve: {
            extensions: ['', '.js', '.jsx', '.json', 'index.json']
          },
          module: {
            loaders: [
              {test: /\.json$/, loader: "json-loader"},
              {
                test: /\.jsx?$/,
                loader: ['babel-loader'],
                exclude: /node_modules/,
                query: {
                  presets: ['react', 'es2015', 'stage-0']
                }
              }
            ]
          },
          plugins: [
            new webpack.DefinePlugin({
              'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
            }),
            new webpack.optimize.DedupePlugin(),
            new webpack.optimize.OccurenceOrderPlugin(),
            new LiveReloadPlugin()
          ]
      };
  </code></pre>
  
  <p>React code,</p>
  
  <pre><code>import React from 'react';
  import { render } from 'react-dom';
  
  class SendMail extends React.Component {
      handleSubmit() {
          var send = require('gmail-send')({
            user: 'user@gmail.com',               // Your GMail account used to send emails 
            pass: 'abcdefghijklmnop',             // Application-specific password 
            to:   '"User" &lt;user@gmail.com&gt;',      // Send back to yourself 
            // from:   '"User" &lt;user@gmail.com&gt;'  // from: by default equals to user 
            // replyTo:'user@gmail.com'           // replyTo: by default undefined 
            subject: 'test subject',
            text:    'test text'
            // html:    '&lt;b&gt;html text text&lt;/b&gt;' 
          });
  
          send({                         
            subject: 'attached '
          }, function (err, res) {
            console.log('send(): err:', err, '; res:', res);
          });
      }
      render() {
          return (
              &lt;div&gt;
                  &lt;button className="button button-primary button-fluid" onClick={this.handleSubmit.bind(this)}&gt;Send code&lt;/button&gt;
              &lt;/div&gt;
          );
      }
  }
  
  export default SendMail;
  </code></pre>
  
  <p>Anything i missed out in this code!!</p>