ES6 Modules In Google Chrome Extension Development (unexpected token)

前端 未结 1 1017
一生所求
一生所求 2021-01-02 13:22

Is it possible to use ES6 modules in Google Chrome Extension Development?

I get \'unexpected token export\' or \'unexpected token import\'.

1条回答
  •  一生所求
    2021-01-02 13:45

    Well sort of, you can see here in the compatibility table for chrome that not everything is available. Chrome is good about adding ES6 features with each release but currently import is not supported.

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

    Now that said, you can use all ES6 features if you use a compiler like babel

    https://babeljs.io/

    Check out this answer for more info, note it is dated: Is it possible to use ES6 in a Chrome Extension?

    0 讨论(0)
提交回复
热议问题