lephyrus / ngx-translate-messageformat-compiler

Advanced pluralization (and more) for ngx-translate, using standard ICU syntax which is compiled with the help of messageformat.js.
MIT License
93 stars 30 forks source link

Problem compiling --prod version with ionic 3.8.x angular 4.4.x #23

Closed gartorware closed 6 years ago

gartorware commented 6 years ago

Hi, thanks for this amazing lib.

As per docs, v3.0.0 states to be compatible with angular 4.4.x. I'm having problems when compiling ionic prod version, using ionic 3.8.x with angular 4.4.x and this library in its v3.0.0. The error thrown is this: Error: Metadata version mismatch for module /.../node_modules/ngx-translate-messageformat-compiler/src/message-format-config.d.ts, found version 4, expected 3 I guess this is because v3.0.0 is compiled using angular 5.

Downgrading to v2.1.0 solves the issues.

ionic info

cli packages: 

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.9
    Cordova Platforms  : android 7.1.0
    Ionic Framework    : ionic-angular 3.8.0

System:

    Android SDK Tools : 26.1.1
    Node              : v6.14.1
    npm               : 3.10.10
    OS                : Linux 4.13

Misc:

    backend : pro
lephyrus commented 6 years ago

@gartorware Thanks for the report. I'll tell you a secret: the code in this package is trivial - just a few lines really. Getting pluggable compiler support into the core was slightly harder, but the real pain is stuff like your issue. Do you know for a fact that the metadata needed for AOT compilation is not backward-compatible between Angular versions? Is it forward-compatible? I wish there was a resource for Angular library developers with all that info. I guess I'll have to research this, and even then, I'm not sure there's a good fix to be honest.

lephyrus commented 6 years ago

@gartorware Try with v3.0.1, your problem should be fixed.

gartorware commented 6 years ago

Sorry, I have been away for a while. Yeah, I have faced this issue before. Sorry for my late answer, now you have solved it by yourself.

Thank you very much for the quick fix, I can confirm it's working now :D