Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information