• Robert Knight's avatar
    Limit line length in minified JS bundles · 2233d721
    Robert Knight authored
    Limit the line length in minified bundles to make them easier to examine in
    various tools which don't like very long source lines, and also mitigate an
    issue with stack traces in Firefox.
    
    Firefox stack traces report column numbers in Unicode code points whereas Sentry
    expects UTF-16 code units. If the input source contains Unicode characters which
    require multiple UTF-16 code units to represent then processed stack traces in
    Firefox will point to the wrong location.
    
    One of our dependencies (Showdown) contains a long string of emojis, which
    require multiple UTF-16 units to represent, and Terser by default tries to
    compress the code into as few lines as possible. The combined result of this is
    that stack traces from Firefox could end up being resolved to a location far
    from what is expected.
    
    Though it is not a complete fix for the issue, limiting the length of lines
    effectively mitigates this problem as only code nearby (on the same line as)
    these characters in the output is affected.
    
    I did also try Terser's `ascii_only` output option, but that increased the
    bundle size by 2% and has more potential for unexpected consequences elsewhere.
    2233d721
rollup.config.mjs 3.31 KB