Closed mbudde closed 5 years ago
Actually, after some experimenting, I can see we get significant space savings if data-autocomplete2 is built without polyfilling (the polyfills seems to make up around half of the compiled module size).
What do you think about adding additional build outputs that does not include polyfills, like this: https://github.com/Jobindex/dawa-autocomplete2/commit/1eee54de2bed78d0a38116664f0a279d663d7c89.
It is definitely not the intention that the included polyfills overwrite the global Promise object. I'll take a look at this.
So I have looked further into this. It would seem that core-js overrides any existing Promise. I was not aware of that.
We currently use the preset-env babel plugin to polyfill anything not supported by IE11. However, this pollutes the global namespace.
Using transform-runtime instead together with core-js version 3 apparently rewrites the code to use imports instead of polluting the global namespace. That would be much better - however, it seems to me that it imports EVERYTHING, including stuff already supported by IE11, adding further unneccessary bloat to the code size. I cannot seem to find any plugins combining the functionality of preset-env and tranform-runtime.
I can definitely see why you would want a build without polyfills. This will be provided.
I published version 1.0.2. Files built without polyfills is in the /dist/js/unfilled folder, or via CDN:
http://cdn.aws.dk/assets/dawa-autocomplete2/1.0.2/unfilled/dawa-autocomplete2.min.js
Thank you for adding an unpolyfilled version. That solves our issue :+1:
The polyfills included in this library overwrites the global namespace. In particular it replaces the
Promise
object with a version that does not have the.finally()
method. This breaks our app which expects this method.Could you change the build setup so the bundled polyfills doesn't change the global namespace (perhaps by using
@babel/plugin-transform-runtime
)?