ECMA 6 Not working although experimental js is enabled

前端 未结 3 1354
慢半拍i
慢半拍i 2020-12-02 00:27

I have the latest Chrome version (45 and also Chrome Canary which is in version 47), both with the Experimental Javascript flag enabled. I want to use ECMA6, but it doesn\'t

3条回答
  •  孤城傲影
    2020-12-02 01:09

    Modules are not yet natively supported in any browser. You will need to use a transpiler such as Traceur or Babel. Take a look at one of the following to help you get started:

    • Choose ES6 modules Today!
    • ES6 In Depth: Using ES6 today with Babel and Broccoli
    • Writing client-side ES6 with webpack

    As for classes, you may be able to use these natively without having to go through a transpiler. You can check the compatibility table here to see which browsers support classes natively today:

    https://kangax.github.io/compat-table/es6/

    As of right now, you can see that the majority of browsers do not yet support classes natively. However, if you are using Babel or Traceur, that shouldn't be a concern.

提交回复
热议问题