将外部js文件加载到jhipster生成的angular应用中

时间:2019-03-22 14:24:30

标签: angular jhipster

如何像在通常的angular-cli应用程序中的angular.json中那样,在jhipster生成的angular应用程序中加载外部js文件。

我有应该加载的这些脚本:

 "scripts": [
  "node_modules/ngx-extended-pdf-viewer/assets/pdf.js",
  "node_modules/ngx-extended-pdf-viewer/assets/pdf.worker.js",
  "node_modules/ngx-extended-pdf-viewer/assets/viewer.js"
]

以及这些资产:

{
    "glob": "**/*",
    "input": "node_modules/ngx-extended-pdf-viewer/assets/locale",
    "output": "/assets/locale/"
  }

我已经搜索了很多解决方案,并尝试了许多变通方法,例如使用index.html进行加载或使用vendor.ts或使用CopyWebpackPlugin之类的方法:

   new CopyWebpackPlugin([
        { from: './node_modules/swagger-ui/dist/css', to: 'swagger-ui/dist/css' },
        { from: './node_modules/ngx-extended-pdf-viewer/assets/locale', to: 'ngx-extended-pdf-viewer/assets/locale' },
        { from: './node_modules/swagger-ui/dist/lib', to: 'swagger-ui/dist/lib' },
        { from: './node_modules/swagger-ui/dist/swagger-ui.min.js', to: 'swagger-ui/dist/swagger-ui.min.js' },
        { from: './node_modules/ngx-extended-pdf-viewer/assets/pdf.js', to: 'ngx-extended-pdf-viewer/assets/pdf.js' },
        { from: './node_modules/ngx-extended-pdf-viewer/assets/pdf.worker.js', to: 'ngx-extended-pdf-viewer/assets/pdf.worker.js' },
        { from: './node_modules/ngx-extended-pdf-viewer/assets/viewer.js', to: 'ngx-extended-pdf-viewer/assets/viewer.js' },])

但是它不起作用。有什么想法吗?

0 个答案:

没有答案