Wednesday 27 February 2019

babel 7 don't compile class ES6 in node_modules

I have error in IE11 SCRIPT1002: Syntax error (problem with class syntax) My simple code with 2 lines:

import { struct } from 'superstruct';
console.log('finished');

I wan't that my babel7 compile class into ES5 code

I have tried write .babelrc file :

 {
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "ie": "11"
        }
      }
    ]
  ]
}

and https://babeljs.io/docs/en/babel-plugin-transform-classes haven't fixed too

Update : I have tried use @babel/plugin-preset-es2015 which convert class in ES5 code but this package is deprecated in babel7



from babel 7 don't compile class ES6 in node_modules

No comments:

Post a Comment