问题描述
我正在使用MEAN Stack编写一个Web应用程序,并尝试用ECMAScript 6 JavaScript编写代码;但是,当使用导入和导出语法时,Chrome和Firefox都会收到错误。目前是否有任何完全支持ECMAScript 6的浏览器?
I am currently writing a web application using the MEAN Stack, and am attempting to write code in ECMAScript 6 JavaScript; however, I am getting errors in both Chrome and Firefox when using import and export syntax. Are there currently any browsers that fully support ECMAScript 6?
请注意:我不是问浏览器是否支持ECMAScript 6。我在问哪些浏览器支持ECMAScript 6导入和导出语法。请参阅
Please note: I am not asking when ECMAScript 6 will be supported by browsers. I'm asking which browsers support ECMAScript 6 import and export syntax. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla#Features_not_yet_supported_by_Firefox
推荐答案
Chrome和Firefox支持 import
和
导出
语法(存在 )。
Chrome and Firefox support import
and export
syntax (there exists tests for proper parsing).
模块加载不支持 - 您无法通过任何方式加载模块,因为它的规格不完整。您必须为此使用某种模块绑定器。我不是前端开发人员,但是我从同事那里听到关于的好评。
What isn't supported is module loading - you can't load module by any means, because specification for it isn't complete. You have to use some kind of module bundler for this. I'm not front-end developer, but I have heard good opinions on Rollup from my coworkers.
这篇关于哪些浏览器支持ECMAScript 6的导入和导出语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!