Google Chrome扩展开发中的ES6模块(意外令牌) [英] ES6 Modules In Google Chrome Extension Development (unexpected token)
问题描述
是否可以在Google Chrome扩展程序开发中使用ES6模块?
Is it possible to use ES6 modules in Google Chrome Extension Development?
我得到'意外令牌导出'或'意外令牌导入'。
I get 'unexpected token export' or 'unexpected token import'.
推荐答案
好了,您可以在兼容性表格中看到铬合金,但并非所有工具都可用。 Chrome在每个版本中都增加了ES6功能,但目前不支持导入。
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/
既然如此,如果您使用像babel这样的编译器,则可以使用所有ES6功能
Now that said, you can use all ES6 features if you use a compiler like babel
查看更多信息,请注意它的日期:是否可以在Chrome扩展中使用ES6?
Check out this answer for more info, note it is dated: Is it possible to use ES6 in a Chrome Extension?
这篇关于Google Chrome扩展开发中的ES6模块(意外令牌)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!