adamhalasz / uniqid

Unique ID Generator
https://adamhalasz.com
617 stars 49 forks source link

Failed to minify the code from this file: node_modules/uniqid/index.js:18 #34

Open djErock opened 4 years ago

djErock commented 4 years ago

I ran "npm audit fix" and it upgraded uniqid to 5.2.0 but when i attempt to run a build it breaks with:

Failed to minify the code from this file: node_modules/uniqid/index.js:18

I downgraded uniqid package to 5.0.3 and the error went away.

The error is so cryptic I couldn't even track down the line. The line 18 above is just a for in loop.

BTW... I am not using react-scripts and ejected long ago..

djErock commented 4 years ago

I ran "npm audit fix" and it upgraded uniqid to 5.2.0 but when i attempt to run a build it breaks with:

Failed to minify the code from this file: node_modules/uniqid/index.js:18

I downgraded uniqid package to 5.0.3 and the error went away.

The error is so cryptic I couldn't even track down the line. The line 18 above is just a for in loop.

BTW... I am not using react-scripts and ejected long ago..

Had this crop up in the past with import statements --> reference here: https://stackoverflow.com/questions/45671597/failed-to-minify-the-code-from-this-file

Ashish1857 commented 4 years ago

It is still showing same error? any fix/idea ?

Awem commented 4 years ago

The problem is caused by using ES6 code in index.js (let, constetc.). If the tool your are using for uglification does not support ES6 code, it will fail. You could use an uglifyer that supports it (e.g. Terser), but the proper fix would be to ensure ES5 compatibility of indes.js because it is a distributed file.

Awem commented 4 years ago

Same as https://github.com/adamhalasz/uniqid/issues/22

mrwadepro commented 4 years ago

I'm having the same issue, react-scripts is updated to the latest version as well.