ngx-translate-messageformat-compiler icon indicating copy to clipboard operation
ngx-translate-messageformat-compiler copied to clipboard

Class constructor TranslateCompiler cannot be invoked without 'new'

Open lucasskluser opened this issue 4 years ago • 4 comments

Hi from Brazil!

I'm trying to use TranslateMessageFormatCompiler in an Angular 7.1 project, however, my application doesn't work, as the following error is thrown:

image

Angular CLI: 7.3.10 Node: 13.12.0 OS: win32 x64 Angular: 7.1.4 @ngx-translate/core: 13.0.0 ngx-translate-messageformat-compiler: 4.7.0 messageformat: 2.0.5

In my app.module imports:

image

And providers:

image

I appreciate if you can help me.

lucasskluser avatar Jul 30 '20 22:07 lucasskluser

Having the same issue with Angular 10:

Angular CLI: 10.1.2
Node: 12.18.3
OS: darwin x64

Angular: 10.1.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1001.2
@angular-devkit/build-angular   0.1001.2
@angular-devkit/core            10.1.2
@angular-devkit/schematics      10.1.2
@angular/cdk                    10.2.1
@angular/material               10.2.1
@schematics/angular             10.1.2
@schematics/update              0.1001.2
rxjs                            6.6.3
typescript                      3.9.7
@ngx-translate/[email protected] 
[email protected]
[email protected]

Is there anything we should provide to narrow this down?

jessorlisa avatar Sep 20 '20 13:09 jessorlisa

@lucasskluser Did you find a solution?

jessorlisa avatar Sep 23 '20 13:09 jessorlisa

A quick internet search tells me that this probably has to do with module formats and/or what language level is targeted by the library and/or the app including it. I know that's vague, but the thing is: this library provides all kinds of builds (using the standard Angular CLI setup for libraries) and this error does not occur with a default Angular CLI setup for the app using it.

I suggest you try to find the difference between your app setup and the sample projects or the StackBlitz app. Check tsconfig.js (there's usually more than one), angular.json and package.json especially.

lephyrus avatar Sep 23 '20 19:09 lephyrus

@jessorlisa / @lucasskluser Do you have a specific webpack config? The default one from angular should just work fine. I had the same issue using this module in Storybook. I found a way to fix this, thanks to this issue: https://github.com/storybookjs/storybook/issues/11379#issuecomment-662953505

This configuration is done by angular-cli in the hidden webpack config.

vincentpalita avatar Nov 08 '20 16:11 vincentpalita

Closed for staleness. Feel free to re-open if you encounter this.

lephyrus avatar Feb 03 '24 22:02 lephyrus