title: Why does Angular InjectionToken wrapped in an object throw an error?
body: <p>I'm using InjectionToken for injection of configuration.
  This:</p>
  
  <p>configuration.injection-keys.ts</p>
  
  <pre><code>export const CONFIG_INJECTION_KEYS_CORE = {
    offlineproducts: new InjectionToken&lt;OfflineProductsConfig&gt;('core.offlineproducts')
  };
  </code></pre>
  
  <p>somemodule.ts</p>
  
  <pre><code>@NgModule({
    imports: [],
    providers: [
      {
        provide: CONFIG_INJECTION_KEYS_CORE.offlineproducts,
        useValue: CORE_CONFIGURATION.offlineProducts
      }
    ],
  })
  </code></pre>
  
  <p>throws the following error</p>
  
  <pre><code>ERROR in Error: Internal error: unknown identifier {"offlineproducts":{"filePath":"D:/angular/src/app/modules/configuration/configuration.injection-keys.ts","name":"CONFIG_INJECTION_KEYS_CORE","members":[]}}
  </code></pre>
  
  <p>but this does not</p>
  
  <p>configuration.injection-keys.ts</p>
  
  <pre><code>export const CONFIG_INJECTION_KEYS_CORE_OFFLINE_PRODUCTS =
    new InjectionToken&lt;OfflineProductsConfig&gt;('core.offlineproducts');
  </code></pre>
  
  <p>somemodule.ts</p>
  
  <pre><code>@NgModule({
    imports: [],
    providers: [
      {
        provide: CONFIG_INJECTION_KEYS_CORE_OFFLINE_PRODUCTS,
        useValue: CORE_CONFIGURATION.offlineProducts
      }
    ],
  })
  </code></pre>
  
  <p>I would prefer to have my injection keys structured in an object. Makes it more manageable as it grows.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>This error does not happen with <code>ng build</code> (or <code>ng serve</code>) but it does happen with <code>ng build --prod</code>. I double checked all parts of the code that are related to production being enabled and none of them make a difference. Moving CONFIG_INJECTION_KEYS_CORE to the module to have it in the same file makes no difference.</p>