怎么做网站二级页面,什么网络营销,上海哪家网站建设好,乐山市规划和建设局门户网站初学者, 想知道错误出在哪里#xff0c;找到的资料都介绍的以下是我精简后的代码内容#xff0c;错误提示在 main.js import那一行错误提示为#xff1a;SyntaxError: Unexpected token ‘{‘. import call expects exactly one argumentindex.htmlLearnJavscriptbody{backg…初学者, 想知道错误出在哪里找到的资料都介绍的以下是我精简后的代码内容错误提示在 main.js import那一行错误提示为SyntaxError: Unexpected token ‘{‘. import call expects exactly one argumentindex.htmlLearnJavscriptbody{background: #FFFFFF;padding: 0px;margin: 0px;display: flex;/* flex-direction: column-reverse; */justify-content: center;}main.jsimport {hello} from ./lib.js;hello();lib.jsexport function hello() {console.log(hello);}回答浏览器啥时候可以直接用 import了浏览器JS不支持模块系统如果需要需要用requirejs或者seajs或者webpack处理回答回答目前支持 ES6 Module 的浏览器Safari 10.1Chrome 61Firefox 54 需要设置 dom.moduleScripts.enabledEdge 16在浏览器里使用 Module 的方法// 或import ./main.js;需要注意的规范注意引用的路径不支持 main.js支持 /main.js、./main.js、../main.js、**/main.js使用 nomodule 属性向后兼容Modules 默认使用 Defer即慢于同步的请求但先于显式 Defer 的请求引用或内联的 Modules 都支持 Async多次引用同一个Modules只执行一次通常需要 CORS即需要 Access-Control-Allow-Origin: *发送请求默认不包括证书Modules 需要设置可用的 MIME 类型否则不会执行回答不支持import语法可以使用babel转成es5