Webpack umd seemingly breaks stacktrace-js functionality
<p>We're trying to use stacktrace-js with the awesome logary-js (my project) but after going through webpack it would seem it doesn't work anymore.</p>

<p>Here's the configuration for webpack <a href="https://github.com/logary/logary-js/blob/c7fdec752e5ce33843d458e9e6c590657005c60a/webpack.config.js" rel="nofollow noreferrer">https://github.com/logary/logary-js/blob/c7fdec752e5ce33843d458e9e6c590657005c60a/webpack.config.js</a></p>

<p>Here's the output that makes me concerned (<code>npm run build</code>):</p>

<pre><code>&gt; logary@2.0.2 build /Users/h/dev/haf/logary-js
&gt; NODE_ENV=production webpack --progress --color --display-error-details --display-reasons --optimize-minimize

Hash: d1c4b6913d586c4424ce
Version: webpack 1.13.0
Time: 2263ms
        Asset     Size  Chunks             Chunk Names
    logary.js  55.2 kB       0  [emitted]  logary
logary.js.map   407 kB       0  [emitted]  logary
    + 19 hidden modules

WARNING in logary.js from UglifyJs
Side effects in initialization of unused variable promise [./src/index.js:357,8]
Side effects in initialization of unused variable Targets [./src/index.js:382,13]
Dropping side-effect-free statement [./~/jssha/src/sha.js:12,0]
Condition always true [./~/jssha/src/sha.js:37,116]
Condition always true [./~/stacktrace-js/stacktrace.js:6,0]
Dropping unreachable code [./~/stacktrace-js/stacktrace.js:8,5]
Condition always true [./~/error-stack-parser/error-stack-parser.js:6,0]
Dropping unreachable code [./~/error-stack-parser/error-stack-parser.js:8,5]
Condition always true [./~/stackframe/stackframe.js:6,0]
Dropping unreachable code [./~/stackframe/stackframe.js:8,5]
Condition always true [./~/stack-generator/stack-generator.js:6,0]
Dropping unreachable code [./~/stack-generator/stack-generator.js:8,5]
Condition always true [./~/stacktrace-gps/stacktrace-gps.js:6,0]
Dropping unreachable code [./~/stacktrace-gps/stacktrace-gps.js:8,5]
</code></pre>

<p>On <a href="https://github.com/logary/logary-js/tree/uglify-js-options" rel="nofollow noreferrer">this branch</a> I try disable UglifyJs to no avail.</p>

<p><code>npm run test</code> gives this output (snipped):</p>

<pre><code>  stacktrace enricher
    ✓ should be a function
    ✓ should accept a message and return a function
    ✓ passes through messages without errors
    ✓ parses errors in generated errors (385ms)
    ✓ should parse errors into stack traces
</code></pre>

<p>So it would seem the webpack-mocha integration in dev works really well. However, when I use logary from other JS after releasing I get this output from stacktrace-js:</p>

<p><a href="https://i.stack.imgur.com/86Del.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/86Del.png" alt="stacktrace-js enricher for logary-js"></a></p>

<p>When it should fulfil these unit tests (which is does do when I run mocha, but not when I run it in the browser):</p>

<pre><code>  const stacktrace = Middleware.stacktrace
  // snip

  it('passes through messages without errors', function() {
    const msg = Message.event('Signup');
    const res = stacktrace(logger)(msg);
    expect(res.value.event).to.equal('Signup');
    expect(res.level).to.equal('info');
    expect(res.fields).to.deep.equal({});
    expect(res.context).to.deep.equal({
      logger: 'AreaX.ComponentA',
      service: 'MyWebSite'
    });
  });

  it('parses errors in generated errors', function(done) {
    const msg = Message.eventError('Uncomfortable Error', error);
    const subjectMsg = stacktrace(logger)(msg);

    expect(expect(subjectMsg).to.eventually.be.fulfilled.then(msg =&gt; {
      expect(msg.fields).to.be.an('object');
      expect(msg.fields.errors).to.have.lengthOf(1);
      expect(msg.fields.errors[0]).to.not.equal(error);
      expect(msg.fields.errors[0]).to.be.an('Array');
    })).to.notify(done);
  });

  it('should parse errors into stack traces', function(done) {
    const msg = Message.eventError('Uncomfortable Error', error, {
            myField: 'abc'
          }),
          actual = stacktrace(logger)(msg).then(x =&gt; x.fields);

    expect(expect(Promise.all([
      actual,
      StackTrace.fromError(error)
    ])).to.eventually.be.fulfilled.then(([actualFields, expectedError]) =&gt; {
      expect(actualFields.errors[0]).to.deep.equal(expectedError);
      expect(actualFields.myField).to.equal('abc');
    })).to.notify(done);
</code></pre>