Covalent: ng-xi18n fails(aot support)

Created on 11 Nov 2016  Â·  12Comments  Â·  Source: Teradata/covalent

This repository's issues are reserved for feature requests and bug reports.

Bug Report

  • Clone current covalent quickstart(https://github.com/Teradata/covalent-quickstart)
  • Run npm install
  • Run ./node_modules/.bin/ng-xi18n

What is the expected behavior?

No error

Which version of Angular and Material, and which browser and OS does this issue affect?

OS: Windows 10

Other information

Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/dev/covalent-quickstart/src/app/app.module.ts, resolving symbol AppModule in C:/dev/covalent-quickstart/src/app/app.module.ts
at simplifyInContext (C:\dev\covalent-quickstart\node_modules\@angular\compiler-cli\src\static_reflector.js:470:23)
at StaticReflector.simplify (C:\dev\covalent-quickstart\node_modules\@angular\compiler-cli\src\static_reflector.js:473:22)
at StaticReflector.annotations (C:\dev\covalent-quickstart\node_modules\@angular\compiler-cli\src\static_reflector.js:60:36)
at NgModuleResolver.resolve (C:\dev\covalent-quickstart\node_modules\@angular\compiler\bundles\compiler.umd.js:14050:46)
at CompileMetadataResolver.getNgModuleMetadata (C:\dev\covalent-quickstart\node_modules\@angular\compiler\bundles\compiler.umd.js:14296:49)
at C:\dev\covalent-quickstart\node_modules\@angular\compiler\bundles\compiler.umd.js:13284:43
at Array.forEach (native)
at _extractModulesAndPipesOrDirectives (C:\dev\covalent-quickstart\node_modules\@angular\compiler\bundles\compiler.umd.js:13283:28)
at Object.analyzeNgModules (C:\dev\covalent-quickstart\node_modules\@angular\compiler\bundles\compiler.umd.js:13039:16)
at Extractor.extract (C:\dev\covalent-quickstart\node_modules\@angular\compiler-cli\src\extractor.js:34:30)
Extraction failed

enhancement

Most helpful comment

@emoralesb05 This is short summary of getting it up and ready with AOT Support
https://medium.com/@isaacplmann/getting-your-angular-2-library-ready-for-aot-90d1347bcad#.jbe1qjx8u

All 12 comments

Some further investigations:
It looks like that covalent needs to support aot to support native i18n in angular2.

The above error results from calling the following in my module:

imports: [
CovalentCoreModule.forRoot()
]

To "fix" this issue I refactored my code to use an exported function such as:

export function covalentCoreModule() {
  return CovalentCoreModule.forRoot()
}

and using this in imports:

imports: [
covalentCoreModule
]

Which brings to me to the next error:

Error: Unexpected value 'coreModule' imported by the module 'AppModule'
at C:\dev\covalent-quickstart\node_modules\@angular\compiler\bundles\compiler.umd.js:14326:37
at Array.forEach (native)
at CompileMetadataResolver.getNgModuleMetadata (C:\dev\covalent-quickstart\node_modules\@angular\compiler\bundles\compiler.umd.js:14311:46)
at C:\dev\covalent-quickstart\node_modules\@angular\compiler\bundles\compiler.umd.js:13284:43
at Array.forEach (native)
at _extractModulesAndPipesOrDirectives (C:\dev\covalent-quickstart\node_modules\@angular\compiler\bundles\compiler.umd.js:13283:28)
at Object.analyzeNgModules (C:\dev\covalent-quickstart\node_modules\@angular\compiler\bundles\compiler.umd.js:13039:16)
at Extractor.extract (C:\dev\covalent-quickstart\node_modules\@angular\compiler-cli\src\extractor.js:34:30)
at extract (C:\dev\covalent-quickstart\node_modules\@angular\compiler-cli\src\extract_i18n.js:19:35)
at Object.main (C:\dev\covalent-quickstart\node_modules\@angular\tsc-wrapped\src\main.js:30:16)
Extraction failed

According to(https://github.com/angular/angular/issues/11262) this issue relates to the fact that there is no metadata.json available per module which will be generated by executing the angular compiler with "ngc -p tsconfig.json" instead of using typescript.

I tried to play arround with building covalent with ngc instead of typescript but it fails because ngc does not support scss(https://github.com/angular/angular/issues/11815) compilation and it needs to be done beforehand.

I am not fully aware of the build process behind covalent but I hope my first investigations give some insights.

Thanks for the info. We havent done any AoT testing, but its in our radar and roadmap. Ill start researching about what we need to do in the building/publishing process to allow that.

Any additional info you can find would be awesome!

@emoralesb05 This is short summary of getting it up and ready with AOT Support
https://medium.com/@isaacplmann/getting-your-angular-2-library-ready-for-aot-90d1347bcad#.jbe1qjx8u

Awesome, ill check this articule out since AoT support is needed more and more every day.

Thanks!

Hopefully https://github.com/Teradata/covalent/pull/209 will resolve this.

Should be fixed in 0.10.
If the issue still persists please fill free to reopen :smile:

when do you plan to release this version ? (0.10) this issue is kinda blocker for us

We are working hard to release asap. Adding more goodies to the release :smile:

Cool, thanks!

Le jeu. 29 déc. 2016 19:29, Ed Morales notifications@github.com a écrit :

We are working hard to release asap. Adding more goodies to the release 😄

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Teradata/covalent/issues/149#issuecomment-269671982,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAdrXLU0n1rPL-aPu9kUtodk2XP-Gk4tks5rM_wVgaJpZM4Kvx-L
.

>


"Love is all around! Enjoy!"

  • HTML* Please read this message with html support enabled
    Please don't print this e-mail unless you really need to

The typescript version other than _2.0.10_ is having an issue with the covalent/core/file/directive/file-drop.directive.ts regarding the type of DOMStringList

Argument of type 'string[]' is not assignable to parameter of type 'DOMStringList'.

It is probably an issue with typescript which is there in all the higher versions causing an error during the build

Yep, we are aware if this since angular didnt support [email protected] until 2.4.2. We just merged a PR that will fix this. https://github.com/Teradata/covalent/pull/241

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Sabartius picture Sabartius  Â·  4Comments

iceman3000 picture iceman3000  Â·  4Comments

fxstein picture fxstein  Â·  5Comments

emoralesb05 picture emoralesb05  Â·  5Comments

d3viant0ne picture d3viant0ne  Â·  3Comments