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

AoT fails with NgModules & UpgradeAdapter.upgradeNg1Component #11307

Closed
guojenman opened this issue Sep 3, 2016 · 3 comments
Closed

AoT fails with NgModules & UpgradeAdapter.upgradeNg1Component #11307

guojenman opened this issue Sep 3, 2016 · 3 comments
Labels
area: core Issues related to the framework runtime freq2: medium type: bug/fix

Comments

@guojenman
Copy link

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
When adding the value returned from UpgradeAdapter.upgradeNg1Component into the declarations array of NgModule, AoT fails with the error below

export const Ng1Component = adapter.upgradeNg1Component('ng1Component');
@NgModule({
  imports: [BrowserModule],
  declarations: [TestApp, Ng1Component],
  bootstrap: [TestApp]
})
export class TestModule {}
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 Ng1Component in /Users/guojian.wu/Downloads/ng2bad-build/src/app/main.ts, resolving symbol TestModule in /Users/guojian.wu/Downloads/ng2bad-build/src/app/main.ts, resolving symbol TestModule in /Users/guojian.wu/Downloads/ng2bad-build/src/app/main.ts
    at simplifyInContext (/Users/guojian.wu/Downloads/ng2bad-build/node_modules/@angular/compiler-cli/src/static_reflector.js:473:23)
    at StaticReflector.simplify (/Users/guojian.wu/Downloads/ng2bad-build/node_modules/@angular/compiler-cli/src/static_reflector.js:476:22)
    at StaticReflector.annotations (/Users/guojian.wu/Downloads/ng2bad-build/node_modules/@angular/compiler-cli/src/static_reflector.js:61:36)
    at _loop_1 (/Users/guojian.wu/Downloads/ng2bad-build/node_modules/@angular/compiler-cli/src/codegen.js:53:54)
    at CodeGenerator.readFileMetadata (/Users/guojian.wu/Downloads/ng2bad-build/node_modules/@angular/compiler-cli/src/codegen.js:66:13)
    at /Users/guojian.wu/Downloads/ng2bad-build/node_modules/@angular/compiler-cli/src/codegen.js:100:74
    at Array.map (native)
    at CodeGenerator.codegen (/Users/guojian.wu/Downloads/ng2bad-build/node_modules/@angular/compiler-cli/src/codegen.js:100:35)
    at codegen (/Users/guojian.wu/Downloads/ng2bad-build/node_modules/@angular/compiler-cli/src/main.js:7:81)
    at Object.main (/Users/guojian.wu/Downloads/ng2bad-build/node_modules/@angular/tsc-wrapped/src/main.js:30:16)

Expected/desired behavior
It should compile without error

Reproduction of the problem
ng2bad-build.zip

See attached project for error reproduction

npm run tsc (works)
npm run ngc (does not work - throws error from above)

Please tell us about your environment:

  • Angular version: 2.0.0-rc.6
  • OS: OSX 10.10.5
  • Language: [TypeScript 2.0.2]

Originally reported to a different issue #10789 (comment)
But according to @chuckjaz, the issue is different enough to warrant a new bug report

@ericmartinezr
Copy link
Contributor

ericmartinezr commented Sep 3, 2016

See #11262, #11133, #11069, #10789 I missed the last part, ignore this comment.

@guojenman
Copy link
Author

switched to UpgradeComponent

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime freq2: medium type: bug/fix
Projects
None yet
Development

No branches or pull requests

4 participants