升级到Angular 7后,我无法使用AOT(使用Ionic)创建构建。
我跑步ionic cordova build android
并得到
ERROR in Error during template compile of 'AppModule'
Function calls are not supported in decorators but 'NgForageModule' was called.
app.module.ts:
import {NgForageModule, Driver} from 'ngforage';
...
imports: [
NgForageModule.forRoot({
name: 'next-storage',
driver: [
Driver.INDEXED_DB,
Driver.WEB_SQL,
Driver.LOCAL_STORAGE
]
}),
...
]
...
我必须使用DEFAULT_CONFIG
提供的并将自定义配置从imports
移至providers
。
的变化app.module.ts
:
import {Driver, NgForageOptions, DEFAULT_CONFIG} from 'ngforage';
...
const ngfRootOptions:NgForageOptions = {
name: 'next-storage',
driver: [
Driver.INDEXED_DB,
Driver.WEB_SQL,
Driver.LOCAL_STORAGE
]
};
...
providers: [
{
provide: DEFAULT_CONFIG,
useValue: ngfRootOptions
}
...
]
...
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句