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

Issues with AOT Compiler in Angular CLI #1

Closed
kuuurt13 opened this issue Feb 22, 2017 · 10 comments
Closed

Issues with AOT Compiler in Angular CLI #1

kuuurt13 opened this issue Feb 22, 2017 · 10 comments
Assignees
Labels

Comments

@kuuurt13
Copy link
Owner

kuuurt13 commented Feb 22, 2017

When using AOT compiler in Angular CLI it throws the following exception:

ERROR in Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing
the function or lambda with a reference to an exported function, resolving symbol NgModule in /home/kuuurt/Workspace/blockUI/node_modules/ng-block-ui/
node_modules/@angular/core/src/metadata/ng_module.d.ts, resolving symbol NgModule in /home/kuuurt/Workspace/blockUI/node_modules/ng-block-ui/node_modu
les/@angular/core/src/metadata.d.ts, resolving symbol NgModule in /home/kuuurt/Workspace/blockUI/node_modules/ng-block-ui/node_modules/@angular/core/s
rc/core.d.ts, resolving symbol NgModule in /home/kuuurt/Workspace/blockUI/node_modules/ng-block-ui/node_modules/@angular/core/index.d.ts, resolving sy
mbol BlockUIModule in /home/kuuurt/Workspace/blockUI/node_modules/ng-block-ui/lib/block-ui.module.ts, resolving symbol BlockUIModule in /home/kuuurt/W
orkspace/blockUI/node_modules/ng-block-ui/lib/block-ui.module.ts
@kuuurt13 kuuurt13 added the bug label Feb 22, 2017
@kuuurt13 kuuurt13 self-assigned this Feb 22, 2017
@shuryyy
Copy link

shuryyy commented Feb 23, 2017

Same here :(

@kuuurt13
Copy link
Owner Author

@shuryyy I have found an article on getting libraries ready for AOT. I hope to have a fix for this soon. https://medium.com/@isaacplmann/getting-your-angular-2-library-ready-for-aot-90d1347bcad#.7xjmfhv64

@kuuurt13
Copy link
Owner Author

524d976 (v0.2.0) adds AOT support. Changes have been tested with Angular CLI AOT compilation.

@shuryyy
Copy link

shuryyy commented Feb 27, 2017

Hi @kuuurt13 I tested it with angular-cli 1.0.0-rc.0 And I still have an error.

ERROR in Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol NgModule in D:/codecommit/eptwiterstats/ep-twitter-chat/node_modules/ng-block-ui/node_modules/@angular/core/src/metadata/ng_module.d.ts

I also have a warning

WARNING in ./src/app/app.component.ts
32:50-59 "export 'NgBlockUI' was not found in 'ng-block-ui'

Strang because I can see the export in your index.ts ...

@shuryyy
Copy link

shuryyy commented Feb 27, 2017

Here is the complete error

ERROR in Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol NgModule in D:/codecommit/eptwiterstats/ep-twitter-chat/node_modules/ng-block-ui/node_modules/@angular/core/src/metadata/ng_module.d.ts, resolving symbol NgModule in D:/codecommit/eptwiterstats/ep-twitter-chat/node_modules/ng-block-ui/node_modules/@angular/core/src/metadata.d.ts, resolving symbol NgModule in D:/codecommit/eptwiterstats/ep-twitter-chat/node_modules/ng-block-ui/node_modules/@angular/core/src/core.d.ts, resolving symbol NgModule in D:/codecommit/eptwiterstats/ep-twitter-chat/node_modules/ng-block-ui/node_modules/@angular/core/index.d.ts, resolving symbol BlockUIModule in D:/codecommit/eptwiterstats/ep-twitter-chat/node_modules/ng-block-ui/dist/lib/block-ui.module.d.ts, resolving symbol BlockUIModule in D:/codecommit/eptwiterstats/ep-twitter-chat/node_modules/ng-block-ui/dist/lib/block-ui.module.d.ts

@kuuurt13
Copy link
Owner Author

@shuryyy I just tested again by creating a fresh app with angular-cli and it was compiling for me. Can you run npm list @angular/cli @angular/compiler-cli and let me know what versions you are on? I'm currently on these versions @angular/[email protected] @angular/[email protected] and that seems to work fine.

As for the export 'NgBlockUI' was not found in 'ng-block-ui' warning I think this might be unique to angular-cli, see angular/angular-cli#2034. I tested with an app that is using a webpack build process without angular-cli and it builds with no errors. I will try to do some research and see if there is a fix I can implement for now.

@kuuurt13 kuuurt13 reopened this Feb 27, 2017
@kuuurt13
Copy link
Owner Author

@shuryyy sorry I over looked that you said you are on 1.0.0-rc.0. I will upgrade and see if I run into any issues.

@kuuurt13
Copy link
Owner Author

@shuryyy I just updated angluar-cli to 1.0.0-rc.0 and ran ng serve --aot (I think it does aot by default but added the flag to be sure). Everything compiled for me and the app came up fine. Below is my setup:

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { BlockUIModule } from 'ng-block-ui';
import { AppComponent } from './app.component';


@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    BlockUIModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

app.component.ts

import { Component } from '@angular/core';
import { BlockUI, NgBlockUI } from 'ng-block-ui';


@Component({
  selector: 'app-root',
  template: `
    <block-ui>
      <h1>{{ title }}</h1>
    </block-ui>
  `,
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'app works!';
  @BlockUI() blockUI: NgBlockUI;

  constructor() {
    this.blockUI.start();
  }
}

This was with creating a brand new app with ng new. If your app was on an older version of the cli and you updated, maybe there was an issue with the upgrade process. You might have already gone through this but I found this wiki from angular-cli team about upgrading https://github.com/angular/angular-cli/wiki/stories-rc.0-update. If you are still having issues you could try creating a new throwaway app with the cli, add my changes above and then see if it compiles. Let me know how everything works out.

@shuryyy
Copy link

shuryyy commented Feb 27, 2017

Re @kuuurt13,

So I just did the same but with the option ng new project --ng4. And this is the issue I think...
I'm using the RC of angular 4 for the rest I have the same code as you.
Here is the package.json generated by a-cli.

{

"name": "project",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": ">=4.0.0-beta <5.0.0",
"@angular/compiler": ">=4.0.0-beta <5.0.0",
"@angular/core": ">=4.0.0-beta <5.0.0",
"@angular/forms": ">=4.0.0-beta <5.0.0",
"@angular/http": ">=4.0.0-beta <5.0.0",
"@angular/platform-browser": ">=4.0.0-beta <5.0.0",
"@angular/platform-browser-dynamic": ">=4.0.0-beta <5.0.0",
"@angular/router": ">=4.0.0-beta <5.0.0",
"core-js": "^2.4.1",
"ng-block-ui": "^0.3.0",
"rxjs": "^5.1.0",
"zone.js": "^0.7.6"
},
"devDependencies": {
"@angular/cli": "1.0.0-rc.0",
"@angular/compiler-cli": ">=4.0.0-beta <5.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.4.2",
"typescript": "~2.1.0"
}
}

@kuuurt13
Copy link
Owner Author

@shuryyy, I currently wasn't supporting 4.x but I just added support, see #6 for details. Can you try testing your 4.x app after running npm install ng-block-ui@next? This should get the beta version I published on npm that has support for 4.x. I tested it with a new angular-cli app using the --ng4 flag and it seems to be working fine.

Since this issue was originally for AOT compiling targeting the current released of angular (2.x) I am going to close this. If you can just reply back to #6 with you findings that would be great. I also created a new issue for the warning you are currently seeing for NgBlockUI, see #7.

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

No branches or pull requests

2 participants