filesize.js: Library is broken in non-ES6 browsers

All the versions >= 5.0 are broken in browsers that don’t support ES6 because of this line: https://github.com/avoidwork/filesize.js/blob/3a088db57570ff352eb9a33ccdcb9d07c9fcb04d/tsconfig.json#L9

It may potentially break even evergreen browsers because target: "esnext" doesn’t transpile ESNext code at all which means output may contain unstable ES features (stage-4) which are not yet supported by the browsers natively.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 18 (10 by maintainers)

Most upvoted comments

The company that produces it has had their chief security officer publically state that you shouldn’t use it.

I don’t use webpack, so this isn’t an issue from my pov.

I didn’t make the change, so open an issue and flag the original author

Hmm, here is the PR with the change: https://github.com/avoidwork/filesize.js/pull/104 And all the commits there are yours.

And here is another opened issue with the same problem: https://github.com/avoidwork/filesize.js/issues/109

cool story. this one did as well until someone in the community removed it. ergo, your statement is just relative to yourself (not a bad thing, just stating a fact). you don’t have to run 5.x

@avoidwork it’s a common practice in libraries world to transpire to es5 by default to support IE or transpire to ES6 and mention in the readme that if you still have to support IE then use v4.

Another thing is your TS target is ESNext and your build may potentially break even in the latest Chrome as I mentioned in the main post.

common is whatever you think is popular

All the libraries/frameworks I know provide es5-transpiled code in the main field of the package.json.