davglass / prettysize

Helper utility to provide pretty printed file sizes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not work in IE11

darren-dev opened this issue · comments

Using IE11 and prettysize (Built through webpack), the website doesn't load at all when including prettysize as a package.

You get the following error in the console app.js (6856,1), and the source leads to:
image

Removing prettysize works. Is there any polyfil needed?

As long as webpack converted it to ES5 it should work as expected in IE. It's just simple JS and shouldn't need any polyfil. If you use the 0.1.0 release you don't even need webpack to convert it as it's vanilla JS.

I doubt webpack is at fault - all other libs work perfectly and I have about 6 polyfils. Also, running it outside of webpack is not preferable.

The same problem. IE 11

SCRIPT1002: Syntax error
screenshot_5

Usually webpack babel config does not transpile node_modules files. So I think this might be the cause of this issue

Yes. This is causing issue for UglifyJS too.

From our build log:

       ERROR in application-a35c6ff9c22f1891e0d4.js from UglifyJs
       Unexpected token: keyword (const) [./node_modules/prettysize/index.js:8,0][application-a35c6ff9c22f1891e0d4.js:57645,0]

This issue is fixed by #9 or by adding a build step for prerelease script. For a project of this size I think it would be reasonable to simply lock down allowed language features via ESLint. An example of this here.

@rhys-vdw Yes, no need for es6 for this library and my pull request is very reasonable. The only reason that is not be merged yet should be the maintainers are too busy with saving the world.

As long as webpack converted it to ES5 it should work as expected in IE. It's just simple JS and shouldn't need any polyfil. If you use the 0.1.0 release you don't even need webpack to convert it as it's vanilla JS.

@davglass So the library was upgraded to ES6 so that everyone now has to convert it back to ES5 or use a polyfill?

Can you please explain the rationale behind this decision?

Or maybe @AdrieanKhisbe can shed some more light on why this was ES6-ified in the first place

Merged the ES5 version and published in prettysize@2.0.0