krisk / Fuse

Lightweight fuzzy-search, in JavaScript
https://fusejs.io/
Apache License 2.0
17.89k stars 759 forks source link

IE11 compatibility #374

Closed guillaumewuip closed 4 years ago

guillaumewuip commented 4 years ago

It seems the IE11 compatibility is broken with 5.0.10-beta .

I use webpack to bundle my app and, looking at your rollup config, I think it's probably because webpack use the lib package.json module field when possible.

https://github.com/krisk/Fuse/blob/aa636e62ac2572c879d1fdf4e1d3e50cfc450da7/package.json#L9

If I understand correctly your rollup config, it outputs ES6 (both ES6 modules and other ES6 features) for the esm bundle. https://github.com/krisk/Fuse/blob/aa636e62ac2572c879d1fdf4e1d3e50cfc450da7/scripts/configs.js#L61-L66

Should not the esm bundle be ES5 with ES6 module import/export for tree shaking like explained for example here?

Something like this for the tsconfig.json

{
  "compilerOptions": {
    "module": "es6",
    "target": "es5",
...

Let me know if I can help with a PR :)

krisk commented 4 years ago

Want to create a PR for this?

guillaumewuip commented 4 years ago

Yes 👍

guillaumewuip commented 4 years ago

Looking further on the IE11 crash error, we see this image (1)

This seems to be the babel result of this line https://github.com/krisk/Fuse/blob/e5d4c1c152f6d1cb761b2dc62060e32181f04003/src/search/bitap-search/bitap-score.js#L3

To be IE11 compatible, we should not have object spreading here. It's looks like babel is not removing those.

guillaumewuip commented 4 years ago

381 should fix this

evanmoses-okta commented 4 years ago

This should still be open until #383 is merged.

slorber commented 3 years ago

agree, this is still a problem to me and not sure which version > 5.x I can use with a fix for IE11 / Edge 18.

Afaik the only solution is to ask webpack's babel loader to transpile this lib