Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: patch terser to create proper source-maps [do not merge] #32277

Commits on Oct 2, 2019

  1. build: patch terser to create proper source-maps

    Currently terser is in a broken state where technically unmapped
    bytes in the input file are randomly mapped back to source files.
    
    "unmapped bytes" are bytes in the input file (that should be minified),
    which cannot be mapped back to any source file. This is totally
    valid as some code will be generated by rollup in order to create
    bundles of multiple files. These bytes do not originate from any
    source-file and therefore do not map.
    
    In the current state of Terser where unmapped bytes are mapped to
    random source-files, size tracking tools are not able to determine
    accurate payload size contribution numbers of individual source-files,
    nor do the broken source-maps help with debugging Angular packages
    as some bytes are incorrectly mapping to a wrong file (this is not a
    big deal though as the generated code is not likely to be debugged).
    
    For context why we try to fix the terser bug on our side now: A PR
    to fix this bug on the terser side has been submitted but it had to
    be reverted due to a bug in the latest `mozilla/source-map` library.
    Terser reverted the fix that hit the bug in `mozilla/source-map` as
    they wanted to unblock consumers that use the latest `source-map`
    package. Problem is that the bug in the `source-map` package is widely
    spread and there doesn't seem to be a fix for it any time soon. Meaning
    that source-maps needs to stay broken/incorrect as fixing them would
    always cause developers to hit the `source-map` bug...
    
    See `source-map` bug: mozilla/source-map#385
    See Terser fix: terser/terser#342.
    devversion committed Oct 2, 2019
    Configuration menu
    Copy the full SHA
    bf85cd4 View commit details
    Browse the repository at this point in the history