Angular 应用的文字转语音 - "allowJs is not set" 问题
Text to speech for Angular apps - "allowJs is not set" issue
我无法将 this 语音转文本包集成到我的 Angular 应用程序中。我添加了导入语句:
import spoken from "../../../node_modules/spoken/build/spoken.js";
我的项目能够找到 spoken.js 模块,但它告诉我 "allows is not set".
如果我在我的 tsconfig.json 文件中将该值设置为 true,我就会在其他文件中收到多个 .js 相关错误,并且我无法构建项目。有没有人遇到过类似的事情
这个以前?
如果您想在运行时导入模块但不使用 TypeScript 检查它,请尝试从导入路径中删除 .js
扩展名。
一种方法是通过 tsconfig.json
中的 "checkJs": false
禁用 JS 文件的类型检查。
或者您也可以在 angular.json
文件和控制器中的 scripts
数组中包含该文件,只需声明该变量:
declare const spoken: any;
(随意使用更具体的东西而不是 any
:])
我无法将 this 语音转文本包集成到我的 Angular 应用程序中。我添加了导入语句:
import spoken from "../../../node_modules/spoken/build/spoken.js";
我的项目能够找到 spoken.js 模块,但它告诉我 "allows is not set".
如果我在我的 tsconfig.json 文件中将该值设置为 true,我就会在其他文件中收到多个 .js 相关错误,并且我无法构建项目。有没有人遇到过类似的事情 这个以前?
如果您想在运行时导入模块但不使用 TypeScript 检查它,请尝试从导入路径中删除 .js
扩展名。
一种方法是通过 tsconfig.json
中的 "checkJs": false
禁用 JS 文件的类型检查。
或者您也可以在 angular.json
文件和控制器中的 scripts
数组中包含该文件,只需声明该变量:
declare const spoken: any;
(随意使用更具体的东西而不是 any
:])