Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng-xi18n fails(aot support) #149

Closed
crain opened this issue Nov 11, 2016 · 12 comments
Closed

ng-xi18n fails(aot support) #149

crain opened this issue Nov 11, 2016 · 12 comments
Assignees
Milestone

Comments

@crain
Copy link

crain commented Nov 11, 2016

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

Bug Report

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

@crain
Copy link
Author

crain commented Nov 11, 2016

Could be related to angular/angular-cli#2814 and angular/angular-cli#2201

@crain crain closed this as completed Nov 12, 2016
@crain
Copy link
Author

crain commented Nov 14, 2016

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(angular/angular#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(angular/angular#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.

@crain crain reopened this Nov 14, 2016
@emoralesb05
Copy link
Contributor

emoralesb05 commented Nov 14, 2016

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!

@crain crain changed the title ng-xi18n fails ng-xi18n fails(aot support) Nov 18, 2016
@asaph26
Copy link
Contributor

asaph26 commented Dec 15, 2016

@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

@emoralesb05
Copy link
Contributor

emoralesb05 commented Dec 15, 2016

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

Thanks!

@emoralesb05
Copy link
Contributor

Hopefully #209 will resolve this.

@emoralesb05 emoralesb05 self-assigned this Dec 26, 2016
kyleledbetter pushed a commit that referenced this issue Dec 28, 2016
…al AoT support. closes(#149) (#209)

* upgrade to angular 2.4.1 and rxjs 5.0.1

* upgrade [email protected]

* replaced svgSrc with svgIcon in layouts

* register icons from assets into the MdIconRegistry

* updated certain layouts and layout docs

* fixed svg usage in home, layouts overview and styleguide

* updated icon documentation

* updated docs with "assets:iconname"

* update unit tests with hammerjs

* remove usage of depricated md-input infavor of md-input-container (expect in autocomplete)

* remove deprecated kabab md directives

* replaced portalHost with cdkPortalHost

* replaced md-progress-circle with md-progress-spinner

* replaced md-sidenav-layout with md-sidenav-container

* replaced align with labelPosition in md-checkbox

* used labelPosition="before" explicitly now since default is "after"

* renamed focus-trap into cdk-focus-trap

* make `npm run test` do an ng test with generated code coverage , check linting and run once

* clean scss files and themes for future AoT support

* updated build.conf.js to move ts files excluding spec and app/ ts files

* fixed chart ParseContent enum so its AoT compatible

* missed highlight theme file

* upgrade to [email protected]

* fixed teradata-ux svg

* fixed `npm run test` command

* update .npmignore with aot files that dont need to be published

* changed TS module compilation to es2015 since its needed for tree shaking

* initial AoT tsconfig

* add `npm run aot` for AoT compilation on platform

* script to remove unwanted AoT files from platform publish

* updated `npm run buiild` to include AoT process

* removed relative path imports from charts and data-table themes

* updated published package.json's from core and http modules

* fixed stepper unit tests

* feature(nav-list): better responsive widths

* fix(manage-list): ensure box shadows are correct on desktop

* fix(layout-theme): needed class for bg color

* fixed bug in layouts where it didnt close the sidenav in some cases

* update(material-components): add md-select & updates

* removing obsolete validation

* use any[] instead of object in select docs

* fixed tslint errors

* update copy in FAQ

* removed the deprecated md-tooltip

* spelling/language check

* update(material-components): add chips example

* update(platform.css): add sidenav

* update(material-components): dialogs from material2
@emoralesb05
Copy link
Contributor

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

@rodislav
Copy link

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

@emoralesb05
Copy link
Contributor

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

@rodislav
Copy link

rodislav commented Dec 29, 2016 via email

@sarath-sasikumar
Copy link

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

@emoralesb05
Copy link
Contributor

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. #241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants