tiberiuzuld / angular-gridster2

Angular gridster 2
https://tiberiuzuld.github.io/angular-gridster2
MIT License
1.28k stars 376 forks source link

build fails on angular-cli in prod mode. make AOT complicit. #17

Closed rajesh-kanakabandi closed 7 years ago

rajesh-kanakabandi commented 7 years ago

ERROR in Error encountered resolving symbol values statically. Calling function 'require', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol GridsterComponent in /home/dashboard-ui/node_modules/angular-gridster2/dist/gridster.component.d.ts, resolving symbol GridsterComponent in /home/dashboard-ui/node_modules/angular-gridster2/dist/gridster.component.d.ts

ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/home/dashboard-ui/src' @ ./src/main.ts 5:0-74 @ multi ./src/main.ts

tiberiuzuld commented 7 years ago

Hi @rajesh-kanakabandi , Yes already knew that the AOT fails, is in my plans to make the library AOT compatible soon, in the coming weeks.

rajesh-kanakabandi commented 7 years ago

@tiberiuzuld thank you for the response.

tiberiuzuld commented 7 years ago

Hi @rajesh-kanakabandi , Library v2.6.0 is now compatible with AOT. Let me know if you find any issues.

rajesh-kanakabandi commented 7 years ago

@tiberiuzuld the AOT build is causing these errors on the console(these seem to be introduced in version 2.5.0 when updated to use angular4).

is there any way to make this work with angular 2.x.x

160 "export 'Renderer2' (imported as 'import17') was not found in '@angular/core/index'

WARNING in ./src/$$_gendir/~/angular-gridster2/dist/gridsterItem.component.ngfactory.ts
79:193-211 "export 'Renderer2' (imported as 'import11') was not found in '@angular/core/index'

WARNING in ./src/$$_gendir/~/angular-gridster2/dist/gridster.component.ngfactory.ts
73:121-139 "export 'Renderer2' (imported as 'import10') was not found in '@angular/core/index'

WARNING in ./src/$$_gendir/~/angular-gridster2/dist/gridster.component.ngfactory.ts
113:229-247 "export 'Renderer2' (imported as 'import10') was not found in '@angular/core/index'

WARNING in ./src/$$_gendir/~/angular-gridster2/dist/gridsterPreview.component.ngfactory.ts
56:198-216 "export 'Renderer2' (imported as 'import10') was not fHash: a2bf79545518daf073fa
Time: 25703ms

when I load the page on a browser, I see this error.

@angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.26] node: 6.9.1 os: linux x64 @angular/common: 2.4.10 @angular/compiler: 2.4.10 @angular/core: 2.4.10 @angular/flex-layout: 2.0.0-rc.1 @angular/forms: 2.4.10 @angular/http: 2.4.10 @angular/material: 2.0.0-beta.2 @angular/platform-browser: 2.4.10 @angular/platform-browser-dynamic: 2.4.10 @angular/router: 3.4.10 @angular/compiler-cli: 2.4.10 @angular/cli: 1.0.0-beta.32.3


regards,
Rajesh.
tiberiuzuld commented 7 years ago

Hi @rajesh-kanakabandi , Renderer2 is only available in angular4

The migration for a angular2 app to angular4 should be easy enough. If I downgrade to angular2 then the angular4 apps will have issues because Renderer (1) which is deprecated and functions differently. And with angular2 I will have issues with angular-cli and the demo app.

So I am sorry but you will have to upgrade your app to angular4 and angular-cli@1.0.0 to be able to use AOT.