我尝试在最新发布的 chrome 版本(即 chrome 61)中玩 ES6 功能,在使用过程中遇到了错误import
关键词。
从技术上来说,import
使用以下方法,但控制台显示错误:
import Mymodule from "Mymodule.js"
控制台打印:
未捕获的语法错误:意外的标识符
我已经开启了以下实验性功能:
chrome://flags/#enable-javascript-harmony
chrome://flags/#enable-module-scripts
并进行以下操作:
chrome://flags/#disable-javascript-harmony-shipping
问题是from "Mymodule.js"
.
模块必须是完整 URL(包括协议)、绝对路径(以 / 开头)或相对路径(以 ./ 或 ../ 开头)。
任何其他字符串都保留供将来使用。
source: https://jakearchibald.com/2017/es-modules-in-browsers/#bare-import-specifiers-arent-currently-supported https://jakearchibald.com/2017/es-modules-in-browsers/#bare-import-specifiers-arent-currently-supported(参考自https://developers.google.com/web/updates/2017/09/nic61#modules https://developers.google.com/web/updates/2017/09/nic61#modules )
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)