microsoft / tslib

Runtime library for TypeScript helpers.
BSD Zero Clause License
1.25k stars 126 forks source link

Use old syntax for defaut export object syntax #206

Closed jakebailey closed 1 year ago

jakebailey commented 1 year ago

Fixes #205

The default export is an expression, so the { ... } is actually an object literal (not export names); as such, older runtimes may not support the shorthand object literal syntax. Duplicate the names to keep it working.

andrewbranch commented 1 year ago

Object literal shorthand properties are in the same language spec as export default, so I would be 100% ok with not taking this “fix,” but I won’t fight against it if others think it’s worth it. Presumably a (super old?) version of Uglify was seeing a source string that already had module syntax transformed down or away, but still had other ES2015+ syntax in it. Not a big fan of avoiding ES6 syntax in a file that literally has ES6 in the name and isn’t the default entrypoint.

andrewbranch commented 1 year ago

super old?

Uh, yeah

  • webpack 2.7.0
  • uglify-js 2.8.29
jakebailey commented 1 year ago

Object literal shorthand properties are in the same language spec as export default

TIL! I thought it came separately.

andrewbranch commented 1 year ago

My bad, I forgot you had already opened this PR when I merged #216