You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a codegen library for generating typed validation codecs from a collection of interrelated json schemas. While experimenting with the newly released v7 of https://npm.im/ajv, I observed that its new standalone codegen mode was printing certain validation functions more than once.
Piping such code through esbuild results in the duplicated function being reprinted in duplicate. I've tried via bundling and minifying and have observed the same thing. While this is certainly not a bug--as it is allowed to redefine a named function, it seems--it was surprising to me and inconsistent with rollup's behaviour so I thought that I'd bring it to your attention.
My intuition is that it would make sense to remove all but the last instance of a collection of functions with the same name in the same scope when printing. A quick test shows that hoisting behaviour results in the last instance claiming the binding, even in strict mode:
I'm working on a codegen library for generating typed validation codecs from a collection of interrelated json schemas. While experimenting with the newly released
v7
of https://npm.im/ajv, I observed that its new standalone codegen mode was printing certain validation functions more than once.Piping such code through
esbuild
results in the duplicated function being reprinted in duplicate. I've tried via bundling and minifying and have observed the same thing. While this is certainly not a bug--as it is allowed to redefine a named function, it seems--it was surprising to me and inconsistent withrollup
's behaviour so I thought that I'd bring it to your attention.My intuition is that it would make sense to remove all but the last instance of a collection of functions with the same name in the same scope when printing. A quick test shows that hoisting behaviour results in the last instance claiming the binding, even in strict mode:
dupes.js:
The text was updated successfully, but these errors were encountered: