Core: Translate pipe and ivy

Created on 8 Nov 2018  路  7Comments  路  Source: ngx-translate/core

Current behavior

ng build --prod fails with "enableIvy: true", the error message is The pipe 'translate' could not be found

Expected behavior

ng build --prod should compile with no error

Minimal reproduction of the problem with instructions

Create a sub module with a component using the translate pipe.
See attachment for an example

Environment


ngx-translate version: 11.0.0
Angular version: 7.0.2
[example.tar.gz](https://github.com/ngx-translate/core/files/2560860/example.tar.gz)

For Tooling issues:
- Node version: v8.12.0
- Platform:  Debian stretch

Most helpful comment

@ocombe Can you make sure ngx-translate compiles with ngcc when Angular 8 is released or do you expect pull requests for this?

All 7 comments

Angular version: 7.1.1
node: v10.4.1

You should run ngcc build before building the project: ./node_modules/.bin/ivy-ngcc

But then it comes to another error: "Error: TODO.Diagnostic: Class has multiple Angular decorators."
This is because Translate pipe is decorated with both Pipe and Injectable. I think Injectable should be removed.

same problem here with Angular version 7.2.5
Something new here?

@ocombe Can you make sure ngx-translate compiles with ngcc when Angular 8 is released or do you expect pull requests for this?

when try to precompile node_modules for Ivy - after running in terminal ./node_modules/.bin/ivy-ngcc ngx-translate not compiling successfully...
will be some updates for it?

Compiling @nguniversal/express-engine - esm5
Compiling @nguniversal/module-map-ngfactory-loader - fesm2015
Compiling @nguniversal/module-map-ngfactory-loader - esm2015
Compiling @nguniversal/module-map-ngfactory-loader - fesm5
Compiling @nguniversal/module-map-ngfactory-loader - esm5
Compiling @ngx-translate/core - fesm2015
Error: TODO.Diagnostic: Class has multiple Angular decorators.
    at DecorationAnalyzer.analyzeClass (C:\Projects\proj\node_modules\@angular\compiler-cli\src\ngcc\src\analysis\decoration_analyzer.js:90:23)
    at C:\Projects\proj\node_modules\@angular\compiler-cli\src\ngcc\src\analysis\decoration_analyzer.js:78:87
    at Array.map (<anonymous>)
    at DecorationAnalyzer.analyzeFile (C:\Projects\proj\node_modules\@angular\compiler-cli\src\ngcc\src\analysis\decoration_analyzer.js:78:51)
    at C:\Projects\proj\node_modules\@angular\compiler-cli\src\ngcc\src\analysis\decoration_analyzer.js:68:99
    at Array.map (<anonymous>)
    at DecorationAnalyzer.analyzeProgram (C:\Projects\proj\node_modules\@angular\compiler-cli\src\ngcc\src\analysis\decoration_analyzer.js:68:58)
    at Transformer.analyzeProgram (C:\Projects\proj\node_modules\@angular\compiler-cli\src\ngcc\src\packages\transformer.js:104:57)
    at Transformer.transform (C:\Projects\proj\node_modules\@angular\compiler-cli\src\ngcc\src\packages\transformer.js:66:27)
    at C:\Projects\proj\node_modules\@angular\compiler-cli\src\ngcc\src\main.js:73:37

I get the same error in an Ionic application. Followed the instructions and functions work but pipes not.

I get the same error. Interestingly, the setting "enableIvy": true was working on Angular 6. Only after upgrading to Angular 7, this error started to occur. I then upgraded ngx-translate-core to ^11.01 and ngx-translate/http-loader to ^4.0.0, but that did not help. Only thing that fixed the pipes error was setting "enableIvy": false.

Was this page helpful?
0 / 5 - 0 ratings