Ng-lazyload-image: 无法使用 NG9 进行产品构建

创建于 2020-06-15  ·  2评论  ·  资料来源: tjoskar/ng-lazyload-image

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.1.8
Node: 12.10.0
OS: linux x64

Angular: 9.1.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: No

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.8
@angular-devkit/build-angular     0.901.8
@angular-devkit/build-optimizer   0.901.8
@angular-devkit/build-webpack     0.901.8
@angular-devkit/core              9.1.8
@angular-devkit/schematics        9.1.8
@angular/cdk                      9.2.4
@angular/cli                      9.1.8
@angular/http                     7.2.16
@angular/material                 9.2.4
@ngtools/webpack                  9.1.8
@schematics/angular               9.1.8
@schematics/update                0.901.8
rxjs                              6.5.5
typescript                        3.9.5
webpack                           4.42.0

ng-lazyload-image 版本:^8.0.1

“AppModule”模板编译期间出错
“LazyLoadImageModule”中的装饰器不支持函数表达式
'LazyLoadImageModule' 包含 ../../../ng-lazyload-image/ng-lazyload-image.ts(22,23) 处的错误
考虑将函数表达式更改为导出的函数。

所有2条评论

你好,
您可以尝试添加:

"angularCompilerOptions": {
    "enableIvy": false
  }

在您的tsconfig.jsontsconfig.app.json ,它们看起来像:
tsconfig.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true,
    "enableIvy": false
  }
}

tsconfig.app.json:

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": []
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ],
  "angularCompilerOptions": {
    "enableIvy": false
  }
}

这看起来像 #463 的副本

此页面是否有帮助?
0 / 5 - 0 等级