Material-ui: Failed to minify the code from this file: ./node_modules/material-ui-icons/es/AccessAlarm.js:9

Created on 31 Mar 2018  路  3Comments  路  Source: mui-org/material-ui


Today I upgraded to version 1.0.0-beta.36, and when executing my build command (npm run build, I created the project with CRA) it gives the following error:
Failed to minify the code from this file: ./node_modules/material-ui-icons/es/AccessAlarm.js:9

It didn't happen with 1.0.0-beta.17 version. I downgraded and It allowed me to do the build with no problem.

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Allow the build command to proceed.

Current Behavior

Doesn't allow the build command to proceed.

Steps to Reproduce (for bugs)

  1. Upgrade to 1.0.0-beta.36.
  2. If having a project created with CRA, do npm run build. If you don't, I believe the problem is the minification using UglifyJS, so doing a minify with it should suffice to reproduce.

Your Environment

npm version 5.8.0
node version v6.11.0

| Tech | Version |
|--------------|---------|
| Material-UI | 1.0.0-beta.36 |
| React | 16.3.0 |
| browser | Google Chrome v64 |

question

Most helpful comment

@racsoraul We had no /es folder in 1.0.0-beta.17. Nothing in our package.json is pointing to this folder. I have created a CRA project on my side to confirm the behevior:

import { AccessAlarm } from 'material-ui-icons'; // OK
import AccessAlarm2 from 'material-ui-icons/AccessAlarm'; // OK
import AccessAlarm3 from 'material-ui-icons/es/AccessAlarm'; // KO

[email protected]/es/AccessAlarm.js

The /es folder is a version of Material-UI that is up-to-date with all the currently supported features of the ECMAScript specification. Which mean we will only transpile stage features and apply our custom code transformations. So, it will only work with evergreen browsers.

I believe the problem is the minification using UglifyJS, so doing a minify with it should suffice to reproduce.

Yes, it's. UglifyJS only support ES5. Change your imports.

All 3 comments

And when you compared the two versions of that file, what did you find?

@mbrookes ES6 syntax for 1.0.0-beta.36 version.

@racsoraul We had no /es folder in 1.0.0-beta.17. Nothing in our package.json is pointing to this folder. I have created a CRA project on my side to confirm the behevior:

import { AccessAlarm } from 'material-ui-icons'; // OK
import AccessAlarm2 from 'material-ui-icons/AccessAlarm'; // OK
import AccessAlarm3 from 'material-ui-icons/es/AccessAlarm'; // KO

[email protected]/es/AccessAlarm.js

The /es folder is a version of Material-UI that is up-to-date with all the currently supported features of the ECMAScript specification. Which mean we will only transpile stage features and apply our custom code transformations. So, it will only work with evergreen browsers.

I believe the problem is the minification using UglifyJS, so doing a minify with it should suffice to reproduce.

Yes, it's. UglifyJS only support ES5. Change your imports.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ryanflorence picture ryanflorence  路  3Comments

activatedgeek picture activatedgeek  路  3Comments

ghost picture ghost  路  3Comments

iamzhouyi picture iamzhouyi  路  3Comments

mattmiddlesworth picture mattmiddlesworth  路  3Comments