我安装从https://www.npmjs.com/package/js-beautify角度无法导入库
通过npm install js-beautify --save
再加入进口JS-美化我app.component.ts
单证说要
import jsbeautifier
但它需要引号,所以我使用
import 'jsbeautifier'
但在那之后,当我试图使用它我收到错误:
Failed to compile.
./src/app/app.component.ts
Module not found: Error: Can't resolve 'jsbeautifier' in '/home/oscar/IdeaProjects/lodashteatcherv4/src/frontend/src/app'
@ ./src/app/app.component.ts 14:0-22
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
我也试过这种进口
import '../../node_modules/js-beautify/js/lib/beautify.js'
我采用了棱角分明的CLI 2/4
[使用Angular-CLI安装第三方应用程序](https://stackoverflow.com/questions/42031389/installing-3rd-party-applications-with-angular-cli) – jonrsharpe