意外值null由模块t导入 [英] Unexpected value null imported by the module t

查看:151
本文介绍了意外值null由模块t导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的应用程序(angular2-express-starter的一个分支)部署到Heroku时,我遇到了这个奇怪的问题。 https://totalautosapp.herokuapp.com/
起初我认为这是Heroku,但我
$ b

  Error:由模块't'导入的意外值'null'

是的,有一个很多类似的问题让我更好地理解了这个问题,但让我失望的是模块't'。它指的是什么模块?

大多数问题都表示意外值是'未定义',而不是'null'。这给我带来了一个想法,即它正在导入一个空模块,但仍然不知道哪一个正在做,即使它在devEnvironment中工作。



这里是我的app.module.ts

  import {BrowserModule}来自'@ angular / platform-b​​rowser'; 
从'@ angular / core'导入{NgModule};
从'@ angular / forms'导入{FormsModule};
从'@ angular / http'导入{HttpModule};
从'./app.component'导入{AppComponent};
从'./app.router'导入{routing};
从'./store'导入{effects,store,instrumentation};
从'./shared/shared.module'导入{SharedModule};

@NgModule({
声明:[
AppComponent
],
进口:[
BrowserModule,
SharedModule,
FormsModule,
HttpModule,
store,
特效,
路由,$ b $仪表
],
bootstrap:[
AppComponent

))
export class AppModule {}

如果有人会深入了解,这是我的共享模块: https://codeshare.io/adKKz5



任何帮助将不胜感激。

编辑:

使用console.log我可以比较我的本地版本和heroku版本的输出。所以我发现null模块是来自ngrx / store-devtools的StoreDevToolsModule。



这个输出来自console.log(instrumentation)行中的本地运行。

  Object {ngModule:StoreDevtoolsModule(),providers:Array [3]} 

而这一个来自heroku

  null main.d61dd7a248d9bbd30ca6.bundle。 js:1:5868 

错误:导入的意外值'null'模块't'

解决方案

我有同样的问题,这是因为我的NgModules类有导出默认修饰符。看看你的模块是否具有导出默认值,并删除默认修饰符,因为它不受ngc支持。


I got this strange issue when deploying my app (a fork of angular2-express-starter) to Heroku. https://totalautosapp.herokuapp.com/ At first i thought it was Heroku, but I've deployed it to netlify and same happens.

It says:

Error: Unexpected value 'null' imported by the module 't'

Yes, there are a lot of similar questions that allowed me to understand the issue a lot better, but what blinds me is the module 't'. What module is it referring to?

And most of the questions state that the unexpected value is 'undefined', not 'null'. which brings me the idea that it is importing a null module, but still don't know which one is doing that, even when it works in devEnvironment.

Here's my 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 {}

And if anyone would take a deep look, here's my shared module: https://codeshare.io/adKKz5

Any help would be well appreciated.

EDIT:

Using console.log I was able to compare outputs from my local build and the heroku one. So I detected that the null module is StoreDevToolsModule from ngrx/store-devtools.

This output is from local run in the line console.log(instrumentation)

Object { ngModule: StoreDevtoolsModule(), providers: Array[3] }

And this one from heroku

null  main.d61dd7a248d9bbd30ca6.bundle.js:1:5868

Error: Unexpected value 'null' imported by the module 't'

解决方案

I was having the same issue, it was caused because my NgModules classes had the "export default" modifier. Look if your modules had the export default and remove the "default" modifier as it's not supported by ngc.

这篇关于意外值null由模块t导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆