title: aws + serverless + webpack => cannot find module xxx in prod
body: <p>I want to create a package to deploy on AWS using <strong>serverless</strong> and <strong>webpack</strong>.</p>
  
  <p>In <code>serverless.yml</code> I want to declare all the resources (mainly DynamoDb tables) and the functions. I want to use external <code>node.js</code> libraries.</p>
  
  <p>The folder structure is:</p>
  
  <pre><code>|- serverless.yml
  |- webpack.config.js
  |- package.json
  |- src 
    \ - file1.js
    | - file2.js
  </code></pre>
  
  <p>Extract from serverless.yml</p>
  
  <pre><code>functions:
    function1:
      handler: src/file1.f1
    function2:
      handler: src/file2.f2
  </code></pre>
  
  <p>Extract from webpack.congfig.js</p>
  
  <pre><code>module.exports = {
    entry: {
      file1: './src/file1.js',
      file2: './src/file2.js',
    },
    target: 'node',
    output: {
      libraryTarget: 'commonjs',
      path: path.join(__dirname, '.webpack'),
      filename: '[name].js',
    },
    module: {
      loaders: [
        {
          test: /\.json$/,
          loaders: ['json-loader'],
        },
      ],
    },
  };
  </code></pre>
  
  <p>When doing a <code>serverless deploy</code> everything is ok, but when testing the lambda I get an error:</p>
  
  <pre><code>{
    "errorMessage": "Cannot find module '/var/task/src/file1'",
    "errorType": "Error",
    "stackTrace": [
      "Function.Module._load (module.js:276:25)",
      "Module.require (module.js:353:17)",
      "require (internal/module.js:12:17)"
    ]
  }
  </code></pre>
  
  <p><strong>Can you tell me what am I doing wrong?</strong></p>
  
  <p><strong>Given that I am a newbie with serverless, can you suggest me some "better practice" for the code and development organisation?</strong> (serverless and nodejs are imposed, webpack and everything else is not)</p>