title: Can't import aws-sdk using webpack, and npm installed aws-sdk
body: <p>I am having an issue importing the aws-sdk (or building it with webpack)</p>
  
  <p>my code is </p>
  
  <pre><code>var config = require('./config')
  var AWS = require('aws-sdk');
  AWS.config.region = config.region;
  </code></pre>
  
  <p>which causes a build error of:</p>
  
  <blockquote>
    <p>ERROR in
    ./node_modules/aws-sdk/apis/cognito-identity-2014-06-30.min.json
    Module parse failed: Unexpected token m in JSON at position 0 while
    parsing near 'module.exports = {"v...' You may need an appropriate
    loader to handle this file type.</p>
  </blockquote>
  
  <p>many times.</p>
  
  <p>if I use the code</p>
  
  <pre><code>var config = require('./config')
  var AWS = require('aws-sdk/dist/aws-sdk');
  AWS.config.region = config.region;
  </code></pre>
  
  <p>I get a console error of</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot set property 'region' of undefined</p>
  </blockquote>
  
  <p>my webpack file is:</p>
  
  <pre><code>module.exports = { 
    entry: 'entry.js',
    // Place output files in `./dist/my-app.js`
    output: {
      path: __dirname + '/dist',
      filename: 'my-app.js'
    },  
    resolve: {.
        extensions: [ '.js', '.json', '.jsx'].
    },  
    module: {
      rules: [
        {   
          test: /\.json$/,
          loader: 'json-loader'
        }   
      ]   
    }
  };
  </code></pre>
  
  <p>and my package.json is:</p>
  
  <pre><code>{
    "private": true,
    "dependencies": {
      "amazon-cognito-identity-js": "^2.0.9",
      "aws-sdk": "^2.261.1",
      "crypto-browserify": "^3.12.0",
      "js-cookie": "^2.2.0",
      "webpack-dev-server": "^3.1.4"
    },
    "devDependencies": {
      "json-loader": "^0.5.7",
      "webpack": "^4.12.0",
      "webpack-cli": "^3.0.8"
    },
    "scripts": {
      "build": "webpack --mode development",
      "serve": "webpack-dev-server --mode development --port 3000"
    }
  } 
  </code></pre>