代码之家  ›  专栏  ›  技术社区  ›  Roka545

角度应用程序的文本到语音转换-“allowjs is not set”问题

  •  0
  • Roka545  · 技术社区  · 7 年前

    我无法整合 this 语音到文本包进入我的角度应用程序。我添加了导入语句:

    import spoken from "../../../node_modules/spoken/build/spoken.js";
    

    我的项目能够找到speak.js模块,但它告诉我“allows is not set”。

    如果在tsconfig.json文件中将该值设置为true,那么在其他文件中会出现多个与.js相关的错误,因此无法构建项目。有人遇到过类似的事情吗 这以前?

    2 回复  |  直到 7 年前
        1
  •  1
  •   Matt McCutchen    7 年前

    如果要在运行时导入模块,但不使用typescript检查,请尝试删除 .js 导入路径的扩展名。

        2
  •  1
  •   Martin Adámek    7 年前

    还有一种方法是通过 "checkJs": false 在你 tsconfig.json .

    或者您也可以在 scripts 数组在 angular.json 文件和控制器中,只需声明该变量:

    declare const spoken: any;
    

    (请随意使用更具体的内容,而不是 any :)

    推荐文章