Skip to content

@sentry/browser fails on Babel minification since 5.29.1 #3336

@didnotwant

Description

@didnotwant

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

6.2.2

Description

I’m updating Sentry to the latest version in one of my custom libraries for errors reporting (which uses Sentry as a dependency).

The problem I noticed after the update to 6.2.2 (current latest) is that I wasn't able to compile it (I use Webpack and Babel) the code with success — it actually succeeded but an error at the end occurred:

  [45] ./src/index.js + 153 modules 567 kB {0} [built]
    + 51 hidden modules

ERROR in unknown: Invalid typeof value
npm ERR! code ELIFECYCLE

After deeper investigation it turned out that it’s because Babel doesn’t know (yet) the bigint type in their compilation process:
https://github.com/babel/babel/blob/4b674ea0319340be7b0ccd53f52dc80f4ebaca04/packages/babel-types/src/builders/flow/createTypeAnnotationBasedOnTypeof.ts#L15-L22
and the bigint exists in Sentry Browser since 5.29.1: #3108

My workaround is to disable simplify option (which is enabled by default and causes the whole package code recompilation, in my case the imported Sentry Browser’s code as well) in babel-minify-webpack-plugin:

// webpack.config.js

const MinifyPlugin = require('babel-minify-webpack-plugin');

module.exports = {
  ...
  plugins: [
    new MinifyPlugin({
      simplify: false,
    }, {})
  ],
};

Note: This issue is not a problem with Sentry itself — I’m just pointing out and sharing the wider landscape of possible bug. I believe it could help the others who use similiar stack. I spent enough time on investigation so it deserves describing. And I think this is the proper place for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions