React-color: Osx safari Unexpected keyword 'const'. Const declarations are not supported in strict mode.

Created on 4 Jan 2017  路  3Comments  路  Source: casesandberg/react-color

I receive following error in safari and chrome on devices like iPhone 6S

SyntaxError: Unexpected keyword 'const'. Const declarations are not supported in strict mode.

I found that problem is in material-color library that is used in this project. Added comment to closed issue https://github.com/shuhei/material-colors/issues/13

To compile my app I use webpack2. I do exclude node_modules from compilation so I cant use babel plugin to parse it http://stackoverflow.com/questions/33878586/safari-babel-webpack-const-declarations-are-not-supported-in-strict-mode

Most helpful comment

I solved my problem by adding another rule for the material-colors

{
      test: /\.js$/,
      include: [
        path.resolve(process.cwd(), "node_modules/material-colors/")
      ],
      loader: 'babel-loader',
      query: {
        plugins: ['transform-runtime', 'transform-es2015-block-scoping'],
      }
    },

All 3 comments

I solved my problem by adding another rule for the material-colors

{
      test: /\.js$/,
      include: [
        path.resolve(process.cwd(), "node_modules/material-colors/")
      ],
      loader: 'babel-loader',
      query: {
        plugins: ['transform-runtime', 'transform-es2015-block-scoping'],
      }
    },

Nice workaround @darkowic, how do you deal with slow build times though?

I do not use this library anymore (not directly at least :) ). And also this is fixed by #317

Was this page helpful?
0 / 5 - 0 ratings

Related issues

imsheng picture imsheng  路  6Comments

redguardtoo picture redguardtoo  路  4Comments

stevenxxiu picture stevenxxiu  路  6Comments

Glutnix picture Glutnix  路  4Comments

Prinzhorn picture Prinzhorn  路  6Comments