threepointone / bs-nice

css-in-reason
180 stars 14 forks source link

Minification Fails #25

Open InsidersByte opened 6 years ago

InsidersByte commented 6 years ago

I am using reason-scripts to build my app and when I create a production build I encountered the following error.

yarn run v1.3.2
$ react-scripts build
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

        ./node_modules/bs-nice/lib/js/src/nice.js:1222

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

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Here's Line 1222.

var extractIDs = (
  function (html){
    let regex = /css\-([a-zA-Z0-9\-_]+)/gm <----------
    let match, ids = new Set();
    while((match = regex.exec(html)) !== null) {
      ids.add("." + match[0]);
    }
    return Array.from(ids.values());
  }
);

reason-scripts is build on top of create-react-app so requires code to be ES5 when minifying (see here).

After changing both the lets on line 1222 and 1223 the build succeeds.