Angular找不到变量缓存

时间:2019-10-14 12:45:53

标签: angular go heroku safari

我的Angular应用程序在本地运行时在所有情况下都能正常运行,但是如果将其部署在Heroku(在Go服务器中)上,则在Chrome和Opera上的angular build上(在移动设备,Linux和osx上)都禁用了aot,但是在野生动物园中引发错误:

ReferenceError: Can't find variable: Cache

当我仔细查看该错误时,我想它是来自我的模块提供者。因为它带我去:

 main-es2015[...].js

[...], IP, KM, {
            provide: Cache, // error
            useClass: KM,
            multi: !0
        }],

对应的app.module.ts部分

providers: [
    {provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true},
    {provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptorService, multi: true},
    {provide: HTTP_INTERCEPTORS, useClass: CachingInterceptor, multi: true},
    ApplicationStateService,
    CacheMapService,
    {provide: Cache, useClass: CacheMapService, multi: true}
  ],

缓存提供程序不是多重的,它是多重的,但没有区别

1 个答案:

答案 0 :(得分:0)

有一个名为:

的变量
declare var Cache: {prototype: Cache; new():Cache}

lib.dom.d.ts文件中。我使用的是这个变量,而不是我的cache.ts模型。我真傻  如果您也有缓存模型,请将其放在* .module.ts文件的顶部

import {Cache} from 'path-to-cache-file'
相关问题