【问题标题】:ngx-extended-pdf-viewer working in developpement mode but not in prodngx-extended-pdf-viewer 在开发模式下工作但不在生产模式下工作
【发布时间】:2022-11-29 19:38:13
【问题描述】:

我使用 ngx-extended-pdf-viewer 显示来自 API 9(blob) 的 pdf 文件,everythink 在本地主机上工作正常,但部署后,文件未显示我收到此错误

未捕获的语法错误:意外的标记“<” main.8d7f0b54d7450531.js:1 如果您看到上面的错误消息“expected expression, got '='”:只要您知道自己在做什么,就可以安全地忽略它。这意味着您的浏览器已过时。请更新您的浏览器以从最新的安全更新中获益并享受更快的 PDF 查看器。 main.8d7f0b54d7450531.js:1 使用 ES5 版本的 PDF 查看器。如果您更新浏览器,您的 PDF 文件显示速度会更快。 /assets/pdf-2.16.450-es5.min.js:1 未捕获的语法错误:意外的标记“<”

代码 :

`

<ngx-extended-pdf-viewer 
        [src]='url' 
        [useBrowserLocale]="true" 
        height="100vh">
        [textLayer]="true"
        [showHandToolButton]="true"
        [showPresentationModeButton]="true"
        [showDownloadButton]="false"
    </ngx-extended-pdf-viewer>

`

包.Json:


{ “名称”:“非洲经委会”, “版本”:“0.0.0”, “脚本”:{ “吴”:“吴”, “开始”:“服务”, “构建”:“ng构建”, "watch": "ng build --watch --configuration development", “测试”:“NG测试” }, “私人”:是的, “依赖”:{ "@angular/animations": "^14.2.5", "@angular/common": "^14.2.0", "@angular/编译器": "^14.2.0", "@angular/core": "^14.2.0", "@angular/forms": "^14.2.0", "@angular/platform-b​​rowser": "^14.2.0", "@angular/platform-b​​rowser-dynamic": "^14.2.0", "@angular/router": "^14.2.0", "@fortawesome/angular-fontawesome": "^0.11.1", "@fortawesome/fontawesome-svg-core": "^6.2.0", "@fortawesome/free-brands-svg-icons": "^6.2.0", "@fortawesome/free-regular-svg-icons": "^6.2.0", "@fortawesome/free-solid-svg-icons": "^6.2.0", "@popperjs/core": "^2.11.6", “ag-grid-angular”:“^28.2.0”, “农业网格社区”:“^28.2.0”, “角度确认弹出窗口”:“^6.0.0”, “角谷歌图表”:“^2.2.3”, “引导程序”:“^5.2.2”, "html2pdf.js": "^0.9.0", "jquery": "^3.6.1", "ng2-pdf-viewer": "^9.1.2", “ngx-cookie-服务”:“^14.0.1”, "ngx-easy-table": "^15.3.0", "ngx-extended-pdf-viewer": "^15.0.10", “ngx-toastr”:“^15.2.2”, "pdfjs-dist": "^3.0.279", “rxjs”:“~7.5.0”, "tslib": "^2.3.0", “zone.js”:“~0.11.4” }, “devDependencies”:{ "@angular-devkit/build-angular": "^14.2.5", "@angular/cli": "~14.2.5", "@angular/compiler-cli": "^14.2.0", "@types/茉莉花": "~4.0.0", "@types/jquery": "^3.5.14", “茉莉花核心”:“〜4.3.0”, “业力”:“〜6.4.0”, “业力铬发射器”:“〜3.1.0”, “业力覆盖”:“〜2.2.0”, “业力茉莉花”:“〜5.1.0”, "karma-jasmine-html-reporter": "~2.0.0", “打字稿”:“〜4.7.2” } }


角度.JSON:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "ecaaf": {
      "projectType": "application",
      "schematics": {},
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "allowedCommonJsDependencies": ["",
            "moment-business",
            "ng2-pdf-viewer",
            "pdfjs-dist/build/pdf",
            "pdfjs-dist/web/pdf_viewer"],
            "outputPath": "dist/ecaaf",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets",
              {
                "glob": "**/*",
                "input": "node_modules/ngx-extended-pdf-viewer/assets/",
                "output": "/assets/"
              }
            ],
            "styles": [
              "src/styles.css",
              "node_modules/bootstrap/dist/css/bootstrap.css",
              "node_modules/ag-grid-community/dist/styles/ag-grid.css",
              "node_modules/ag-grid-community/dist/styles/ag-theme-balham.css",
              "node_modules/ngx-toastr/toastr.css"
               
            ],
            "scripts": [
              "node_modules/@popperjs/core/dist/umd/popper.min.js",
              "node_modules/jquery/dist/jquery.min.js",
              "node_modules/bootstrap/dist/js/bootstrap.js"
            ]
          },
          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "10mb",
                  "maximumError": "20mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "10mb",
                  "maximumError": "20mb"
                }
              ],
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "outputHashing": "all"
            },
            "development": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }
          },
          "defaultConfiguration": "production"
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "configurations": {
            "production": {
              "browserTarget": "ecaaf:build:production"
            },
            "development": {
              "browserTarget": "ecaaf:build:development"
            }
          },
          "defaultConfiguration": "development"
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "ecaaf:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "karmaConfig": "karma.conf.js",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.css"
            ],
            "scripts": []
          }
        }
      }
    }
  }
}

我使用最新版本的 ngx-extended-pdf-viewer,angular 14 浏览器谷歌浏览器最新更新

【问题讨论】:

    标签: angular pdf-viewer unexpected-token ngx-extended-pdf-viewer


    【解决方案1】:

    你还没有关闭你的开始标签:

    <ngx-extended-pdf-viewer

    带有“>”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-27
      • 1970-01-01
      • 1970-01-01
      • 2020-08-16
      相关资源
      最近更新 更多