在将我的应用程序(Angular2-express-starter 的一个分支)部署到 Heroku 时,我遇到了这个奇怪的问题。https://totalautosapp.herokuapp.com/起初我以为是 Heroku,但我将它部署到 netlify 上,也发生了同样的情况。
它说:
Error: Unexpected value 'null' imported by the module 't'
是的,有很多类似的问题让我更好地理解了这个问题,但让我蒙蔽的是模块“t”。它指的是哪个模块?
大多数问题都指出意外值是“未定义”,而不是“空”。这让我想到它正在导入一个空模块,但仍然不知道哪个模块正在这样做,即使它在 devEnvironment 中工作。
这是我的 app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { routing } from './app.router';
import { effects, store, instrumentation } from './store';
import { SharedModule } from './shared/shared.module';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
SharedModule,
FormsModule,
HttpModule,
store,
effects,
routing,
instrumentation
],
bootstrap: [
AppComponent
]
})
export class AppModule {}
如果有人愿意深入研究,这是我的共享模块:https://codeshare.io/adKKz5
任何帮助将不胜感激。
EDIT:
使用 console.log 我能够比较本地构建和 Heroku 构建的输出。所以我检测到空模块是来自 ngrx/store-devtools 的 StoreDevToolsModule。
此输出来自 console.log(instrumentation) 行中的本地运行
Object { ngModule: StoreDevtoolsModule(), providers: Array[3] }
还有这个来自heroku
null main.d61dd7a248d9bbd30ca6.bundle.js:1:5868
Error: Unexpected value 'null' imported by the module 't'