无法将模块从库导入代码

时间:2018-12-15 14:02:02

标签: javascript

Javascript:

console.log("here");
import MorseCW from './morse-pro-master/src/morse-pro-cw.js';
console.log("here");
var morseCW = new MorseCW();
morseCW.translate("abc");
var timings = morseCW.getTimings();

index.html:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>repl.it</title>
    <link href="style.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
    <script type = "module" src = "./morse-pro-master/src/morse-pro-cw.js"></script>
    <script src="script.js"></script>
  </body>
</html>

错误:

  

SyntaxError:意外的标识符

请帮助。我有一段时间没有使用JavaScript了。该包已添加到该包的json中。

这是repl

0 个答案:

没有答案