我只想在另一个js文件上导入自定义js模块。
在html头上:
<script src="Dictionary.js" type="module"></script>
<script type="text/javascript" src="Templates.js" ></script>
在模块上:
var Dictionary=function() {...}
export {Dictionary};
在js文件上:
import {Dictionary} from './Dictionary';
我收到这些错误
在Chrome上:
未捕获的SyntaxError:意外令牌{
在Firefox上
SyntaxError:导入声明只能出现在 模块
这两个文件位于同一文件夹中。