哪些浏览器支持 ECMAScript 6 的导入和导出语法? [英] Which browsers support import and export syntax for ECMAScript 6?
问题描述
我目前正在使用 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 导入和导出语法.请参阅 https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla#Features_not_yet_supported_by_Firefox
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
和 export
语法(存在针对 正确 解析).
Chrome and Firefox support import
and export
syntax (there exists tests for proper parsing).
不支持的是模块加载 - 你不能以任何方式加载模块,因为它的规范不完整.为此,您必须使用某种模块捆绑器.我不是前端开发人员,但我从我的同事那里听到了关于 Rollup 的好意见.
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 的导入和导出语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!