Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while uglifying (Unexpected token: operator (>)) using fuse.js 3.4.3 #293

Closed
BogdanDenis opened this issue Mar 7, 2019 · 2 comments · Fixed by OpenTMI/opentmi-default-gui#38 or AndreiShybin/metamask-extension#13 · May be fixed by baophucct/metamask-extension#6
Labels

Comments

@BogdanDenis
Copy link

I'd like to report an issue with the latest version (3.4.3)

After updating to the latest version my build started failing on minification step.

Steps to reproduce:

  1. Use the following package.json
{
  "name": "fusetest",
  "version": "1.0.0",
  "main": "index.js",
  "dependencies": {
    "fuse.js": "3.4.3"
  },
  "devDependencies": {
    "uglifyjs-webpack-plugin": "^2.1.2",
    "webpack": "^4.29.6"
  }
}

And index.js

import { Fuse } from 'fuse.js';

Run
2) npm install
3) npm run build

Verify output:

Hash: 7accaba6ecc9b73295f3
Version: webpack 4.29.0
Time: 574ms
Built at: 03/07/2019 1:18:41 PM
 1 asset
Entrypoint main = main.js
[0] ./index.js 31 bytes {0} [built]
    + 1 hidden module

ERROR in main.js from UglifyJs
Unexpected token: operator (>) [main.js:109,1019]

Then try changing version of fuse.js to 3.4.2 in package.json

  1. rm -rf ./node_modules/ && rm package-lock.json && npm i
  2. npm run build

Verify output:

Hash: e4077f215de091ea71fc
Version: webpack 4.29.0
Time: 940ms
Built at: 03/07/2019 1:25:03 PM
  Asset      Size  Chunks             Chunk Names
main.js  14.1 KiB       0  [emitted]  main
Entrypoint main = main.js
[0] ./index.js 31 bytes {0} [built]
    + 1 hidden module

Tried with uglifyjs-webpack-plugin using webpack and also grunt-contrib-uglify. Both fail.

Could you please look into this issue?
Thanks!

@timbomckay
Copy link

timbomckay commented Mar 8, 2019

Based on the v3.4.3 changes it looks like removing node from the node_js list is the only change that could've impacted this. All the other changes are just formatting.

At least that's the only change, it's possible there's something missing to begin with.

@krisk
Copy link
Owner

krisk commented Mar 9, 2019

Looks like uglifyjs-webpack-plugin can only handle ES5 syntax. There are ES6 Arrow Functions in fuse.js v3.4.3, minified. Hence the issue. One fix would be to update the Fuse.js build + minification process to eliminate Arrows Functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment