这些是我的示例文件:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script src="t1.js"></script>
</head>
<body></body>
</html>
T1.js:
import Test from 't2.js';
T2.js:
export const Test = console.log("Hello world");
当我在 Firefox 46中加载页面时,它返回“ SyntaxError: import 声明可能只出现在模块的顶层”-但我不确定 import 语句在这里还能出现多少顶层。这个错误是否只是转移了注意力,是否还不支持导入/导出?