初学者, 想知道错误出在哪里,找到的资料都介绍的以下是我精简后的代码内容,错误提示在 main.js import那一行错误提示为: SyntaxError: Unexpected token '{'. import call expects exactly one argumentindex.html<!DOCTYPE html><html><head> <title>LearnJavscript</title> <meta charset="utf-8"> <style type = "text/css"> body{ background: #FFFFFF; padding: 0px; margin: 0px; display: flex; /* flex-direction: column-reverse; */ justify-content: center; } </style></head><body> <script src="main.js"></script></body></html>main.jsimport {hello} from './lib.js';hello();lib.jsexport function hello() { console.log('hello');}
3 回答
繁华开满天机
TA贡献1816条经验 获得超4个赞
<script src="main.js"></script>
=>
<script type="module" src="main.js"></script>
添加回答
举报
0/150
提交
取消