mwootendev / ngx-translate-plugins

Utilities plugins for the @ngx-translate translation library.
MIT License
16 stars 10 forks source link

Function calls are not supported in decorators but 'TranslateTestingModule' was called. #21

Closed michal-husak closed 3 years ago

michal-husak commented 4 years ago

Hey,

I am trying to use your TranslateTestingModule in one of my modules TranslationTestHelperModule:

declare var require: any
const TRANSLATIONS_EN = require('../../assets/i18n/en.json');
const TRANSLATIONS_DE = require('../../assets/i18n/de.json');

@NgModule({
  imports: [
    HttpClientTestingModule,
    TranslateTestingModule
      .withTranslations('de', TRANSLATIONS_DE)
      .withTranslations('en', TRANSLATIONS_EN)
      .withDefaultLanguage('de')
  ]
})
export class TranslationTestHelperModule { }

For running the tests it works great, but when I tried to build the project it throws an error:

ERROR in Error during template compile of 'TranslationTestHelperModule'
  Function calls are not supported in decorators but 'TranslateTestingModule' was called.

My TranslationTestHelperModule is used just in the .spec.ts files.

My dependencies:

"@angular/core": "^10.1.3"
"@ngx-translate/core": "^13.0.0"

dev dependencies: "ngx-translate-testing": "^5.0.0"

Any idea how to make the build running?

Thank you.

mwootendev commented 4 years ago

@michal-husak , do you happen to have a sample repository? Just to be clear, ng run test is successful but ng build is failing? Are there any specific build parameters you are using (AoT, build optimizer, etc.)?

mwootendev commented 3 years ago

Closing as unable to reproduce.