Babel 7 doesn't change CONST to VAR

前端 未结 1 1751
长情又很酷
长情又很酷 2021-02-19 05:35

I have problem with Safari version <= 9. Babel doesn\'t seem to replace const with var.

I get this error in console:

Unexpected keyword \'const\'. C

相关标签:
1条回答
  • 2021-02-19 06:17

    did you try to configure preset-env ? you can find the browsers list here: https://github.com/browserslist/browserslist

    probably need to add Safari 8 in your list...

    ["@babel/preset-env", {
      "targets": {
        "browsers": ["last 2 versions"],
      }
    }]
    
    0 讨论(0)
提交回复
热议问题