Closed perrin4869 closed 4 months ago
Thanks a lot Julian for putting together a test case. I'm terribly swamped in work right now but will try to do my best to find out the culprit soon!
git bisect shows ff4ee8ba721967e311f507c01b41bec6555fe63c as the problem (28 May 2022), usage of template literals
interesting, I wasn't aware this was a regression! Thank you so much for looking into it as always 😁
Specifically, it's not the fact that strings are converted to template literals, but that \n
and \r
are being converted to literal characters within template literals (eg. 0x5C6E
=> 0x0A
). This ought to be fine, not sure how undici can tell the difference.
I've found it. See the end of https://tc39.es/ecma262/#sec-static-semantics-trv, it says that a a sequence of literal <CR><LF>
becomes a 0x0A
in the string, not 0x0D0A
as I expected.
that's interesting! this means we get to shave off a few more bytes off our scripts 😆 that's really impressive how you tracked this down!
Unfortunately, it's the reverse hehe. Now must keep the sequence \r
as two characters :-( I've pushed out a fix and will be releasing a new version now.
Thanks! I'll run this on Monday!
everything is fixed! thanks again!!!!
I just ran into this in my last round of dependency updates, one of my project's dependencies pulled in
undici
and my tests started failing ^^;;I managed to isolate the issue to undici, and I put together the file that is not correctly minified (
main.out.js
). I also put together the minified version produced byterser
, which runs on node correctly. I don't really know where to start looking for the problem, since the bundledundici
is quite big, so it's hard to isolate where the problem would be 😅https://github.com/perrin4869/minify-undici-repro
Edit: I just confirmed that esbuild also manages to minify this correctly