anywhichway / nano-memoize

Faster than fast, smaller than micro ... a nano speed and size (780 Brotili bytes) memoize for single and multiple argument functions.
MIT License
213 stars 12 forks source link

IE 11 supported? #10

Closed KiranMohan closed 5 years ago

KiranMohan commented 5 years ago

Is nano-memoize supported on IE11?

I am trying to use Nano-memoize in my web application which also uses Typescript and Webpack to transpile the code to ES5. However the webpage simply fails to load in IE 11. It works in Chrome.

I have followed the following steps:

(the web application is based on create-react-app but the memoized function is not directly used in React components).

anywhichway commented 5 years ago

@KiranMohan I have not tried that combination of options. However, I just ran some quick tests. IE11 does not support Object.assign which is used by nano-memoize and comes through on a Babel ES5 transpile so is likely to come through on webpack also. There is a polyfill here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign You might be able to configure webpack to pull something like this in.

anywhichway commented 5 years ago

@KiranMohan I just pushed v1.1.6 with a test for ie11. All unit tests pass so long as the polyfill for Object.assign is provided.

KiranMohan commented 5 years ago

@anywhichway Figured out the root cause of my issue. See details here https://stackoverflow.com/questions/57968410/webpack-how-to-transpile-code-in-node-modules

I think transpiling nano-memoize might help other users avoid this issue.

And thank you for this awesome library. 👍

anywhichway commented 5 years ago

@KiranMohan Thanks for the compliment. I just pushed v1.1.7 to Github (but not to NPM yet). I re-worked it by hand so it is fully compatible with IE 11 in order to keep the size down and the speed up. Take a look and tell me what you think.

anywhichway commented 5 years ago

@KiranMohan I am closing this so there are not lingering open issues. Re-open if you have a concern.