esbuild / esbuild.github.io

62 stars 45 forks source link

Add more implicit function naming examples to "keep names" section #8

Open overlookmotel opened 3 years ago

overlookmotel commented 3 years ago

This adds a few more examples of implicit function naming to the "keep names" section.

I suppose given the final case, "the name property on functions defaults to a nearby identifier" doesn't quite describe where the name comes from, as 'f' + 'n' is not an identifier. But I'm not sure what a better phrasing is.

minify doesn't do anything which would change the function name in these cases, so keepNames doesn't need to handle it. Though in future if minify condensed {x: 1}.x to just 1, as Terser does, keepNames would need to deal with this case.