Fuse: IE11 broken build

Created on 17 Sep 2020  路  9Comments  路  Source: krisk/Fuse

Describe the bug

I'm using core-js and webpack for development and production. On IE11 my app doesn't run, after commenting the import of my components that use fuse.js, it works flawlessly.

Version

6.4.1

Is this a regression?

I found old closed tickets with a similar issue: https://github.com/krisk/Fuse/issues?q=is%3Aissue+is%3Aclosed+ie11

馃敩Minimal Reproduction

  1. Create a regular webpack build with core-js
  2. Use fuse.js
  3. Open your app in IE11
  4. Watch it burn
Stale bug

Most helpful comment

Found a temporary fix in previous tickets for those in urgent need:
change your import to import Fuse from 'fuse.js/dist/fuse.min.js'

All 9 comments

Found a temporary fix in previous tickets for those in urgent need:
change your import to import Fuse from 'fuse.js/dist/fuse.min.js'

Having the exact same problem.

import Fuse from 'fuse.js/dist/fuse.min.js'

works for me aswell!

Great but how to make this work in TypeScript?

import Fuse from 'fuse.js/dist/fuse.min.js' gives me:

Could not find a declaration file for module 'fuse.js/dist/fuse.min.js'. '/Users/mliquori/prequal-web/node_modules/fuse.js/dist/fuse.min.js' implicitly has an 'any' type.
  Try `npm install @types/fuse.js` if it exists or add a new declaration (.d.ts) file containing `declare module 'fuse.js/dist/fuse.min.js';`ts(7016)

Use tslint ignore next line @mliq

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

Commenting to avoid closing without a fix.

Looks like this is due to the the spread operator being including in the module builds. AFAIK, module should be reserved for ES5 syntax + import/export.

We're running into this as well. I don't think this should be closed.

@mliq I copy-pasted the original fuse.d.ts to my sources (src/fuse.js__dist__fuse.min.js.d.ts) and wrapped it in declare module 'fuse.js/dist/fuse.min.js', and replaces the declares from there with exports, ie. like

declare module 'fuse.js/dist/fuse.min.js' {
  export default Fuse;

  export class Fuse<T> {
  ...
}

Now builds when used import Fuse from 'fuse.js/dist/fuse.min.js'; and types work and works also on IE11 which was the actual, rather sad requirement.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fsskeach picture fsskeach  路  3Comments

stuartpb picture stuartpb  路  3Comments

imanjra picture imanjra  路  3Comments

danielfdickinson picture danielfdickinson  路  4Comments

vexa picture vexa  路  4Comments