title: Uncaught SyntaxError:` Unexpected token import
body: <p>I am working on a react application. Where I am using webpack and babel loader. 
  In my react application I am using import statement many times which is working fine. </p>
  
  <p>Now I have My another stand alone application which is working fine. 
  Now  I am installing my standalone application in react application using npm. So I do </p>
  
  <pre><code>let standAloneApplication =  require("my_stand_alone_application")
  </code></pre>
  
  <p>But I get import error inside the standAloneApplication.  Where I have a line 
  <code>import controller from "./controller" // Main.js:1Uncaught SyntaxError:</code> Unexpected token import</p>
  
  <p>where as import statement in React application works fine.  also the stand alone application work fine at alone. but together It's giving SyntaxError</p>
  
  <p>my webpack file </p>
  
  <pre><code>var webpack = require('webpack');
  var path = require('path');
  
  var BUILD_DIR = path.resolve(__dirname, 'html');
  var APP_DIR = path.resolve(__dirname, 'html');
  
  var config = {
    entry: APP_DIR + '/app.js',
    output: {
      path: BUILD_DIR,
      filename: 'bundle.js'
    },
     devtool: "source-map",
     node: {
       fs: "empty"
     } ,
        module : {
      loaders : [
        {
          test : /\.js?/,
          include : APP_DIR,
          exclude: /node_modules/,
          loaders: ['babel?presets[]=react,presets[]=es2015,plugins[]=transform-decorators-legacy,plugins[]=transform-class-properties,plugins[]=transform-export-extensions'],
        },
  
        { test: /\.json$/, loader: "json" }
      ]
    }
  }
  
  module.exports = config;
  </code></pre>
  
  <p>main.js Code from stand alone application </p>
  
  <pre><code>import {Controller} from "./Controller/index.js"
  
  export class Main () {
  
  } 
  </code></pre>