index.html中引入一个下方这种结构的js文件, 但是报错了
const fn = (() => {
console.log("jinlaile");
})();
export default fn;
原因及解决方案:
览器虽然支持了es6,但是不支持es6的Module直接使用,需要在script标签里加上 type=“module”,让浏览器很好的去认识它。
精彩文章
评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。
index.html中引入一个下方这种结构的js文件, 但是报错了
const fn = (() => {
console.log("jinlaile");
})();
export default fn;
原因及解决方案:
览器虽然支持了es6,但是不支持es6的Module直接使用,需要在script标签里加上 type=“module”,让浏览器很好的去认识它。
精彩文章
本文由 用户 于 2024-04-21 发布在 夸智网,如有疑问,请联系我们。
本文链接:https://www.kuazhi.com/post/713835186.html
发表评论