brianloveswords / base64url

For encoding and decoding base64url!
MIT License
225 stars 44 forks source link

react-scripts build: Failed to minify the code from this file #34

Closed shurik239 closed 6 years ago

shurik239 commented 6 years ago

By trying to build react application it comes to error:

Failed to minify the code from this file: 

    ./node_modules/base64url/dist/base64url.js:4 

Read more here: http://bit.ly/2tRViJ9

They suggest:

Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled.

Note: Create React App can consume both CommonJS and ES modules. For Node.js compatibility, it is recommended that the main entry point is CommonJS. However, they can optionally provide an ES module entry point with the module field in package.json. Note that even if a library provides an ES Modules version, it should still precompile other ES6 features to ES5 if it intends to support older browsers.

base64url: 3.0.0 react-scripts: 1.1.4

magician11 commented 6 years ago

It looks like the issue is this ES6 feature

function encode(input, encoding = "utf8") { (using a default value for a function parameter).

From the docs, it looks like this module needs to compile their code to ES5 and then published to npm.

vongohren commented 6 years ago

Can we get a discussion going on this one? Why would a lib that is so integral to many other libs not be compatible with minification?

MylesBorins commented 6 years ago

We are going to target es5 instead of es6 which fixes this and a couple other issue