TradeMe / ng-defer-load

MIT License
127 stars 36 forks source link

Angular 8 & IVY rendering support #35

Closed szyb closed 1 year ago

szyb commented 4 years ago

Lately I've upgraded my project to latest angular 8.2.14. Despite of warning during npm install, defer-load is working well. But, when I enable IVY engine it fails during loading application

Uncaught ReferenceError: Directive is not defined
    at vendor-es2015.js:117166
    at Object../node_modules/@trademe/ng-defer-load/__ivy_ngcc__/dist/defer-load.directive.js (vendor-es2015.js:117181)
    at __webpack_require__ (runtime-es2015.js:80)
    at Object../node_modules/@trademe/ng-defer-load/__ivy_ngcc__/dist/defer-load.module.js (vendor-es2015.js:117201)
    at __webpack_require__ (runtime-es2015.js:80)
    at Object../node_modules/@trademe/ng-defer-load/__ivy_ngcc__/dist/index.js (vendor-es2015.js:117238)
    at __webpack_require__ (runtime-es2015.js:80)
    at Module../src/app/app.module.ts (main-es2015.js:603)
    at __webpack_require__ (runtime-es2015.js:80)
    at Module../src/main.ts (main-es2015.js:2540)

It would be great to make it work with IVY

djairhogeuens commented 4 years ago

@mzoellner On the Angular 8 support: I see that you have a branch (https://github.com/TradeMe/ng-defer-load/tree/feature-angular-8-upgrade) where support is added. Are you planning on merging this any time soon?

mzoellner commented 4 years ago

Hi, sorry about the delay with this. I just pushed the latest version. This makes the package compatible with both Angular 8 and 9. We tested Ivy support in Angular 9 but not in Angular 8.

@szyb can you test it in your application and let us know if sth. does not work ?

Cheers

szyb commented 4 years ago

Hi,

Sorry for delay too. To be honest I changed priority for IVY rendering and I will back to this, when I want to upgrade to Angular 9. But I still have branch fro IVY testing and I bump there npm version to @trademe/ng-defer-load@^8.0.0. Unfortunately I have still this error. It is also possible, that I'm doing something wrong :) If this is working well for Angular 9, then it is fine for me to close this issue.

Uncaught ReferenceError: Directive is not defined
    at vendor-es2015.js:117166
    at Object../node_modules/@trademe/ng-defer-load/__ivy_ngcc__/dist/defer-load.directive.js (vendor-es2015.js:117181)
    at __webpack_require__ (runtime-es2015.js:80)
    at Object../node_modules/@trademe/ng-defer-load/__ivy_ngcc__/dist/defer-load.module.js (vendor-es2015.js:117201)
    at __webpack_require__ (runtime-es2015.js:80)
    at Object../node_modules/@trademe/ng-defer-load/__ivy_ngcc__/dist/index.js (vendor-es2015.js:117238)
    at __webpack_require__ (runtime-es2015.js:80)
    at Module../src/app/app.module.ts (main-es2015.js:603)
    at __webpack_require__ (runtime-es2015.js:80)
    at Module../src/main.ts (main-es2015.js:2540)
mzoellner commented 4 years ago

Hi @szyb, I have pushed a couple of updates to this library to npm. Can you try the latest version with your IVY branch and let me know if it works. We are in the progress of upgrading to ng9, so we might run into similar issues soon, but keen to see if it resolved your problem.

szyb commented 4 years ago

Hi,

I use 8.2.1 version and now I have compilation error: ERROR in No suitable injection token for parameter '_element' of class 'DeferLoadDirective'. no type or decorator

Probably it is related to my build env, because when I back to 8.0.0 version I've got the same error and it was compiling well before (there was only runtime error). Any thoughts?

NoHara42 commented 3 years ago

Hi, upon a simple installation and import into app.module.ts, following error occurred:

    ERROR in node_modules/@trademe/ng-defer-load/defer-load.module.d.ts:1:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

    This likely means that the library (@trademe/ng-defer-load) which declares DeferLoadModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

I assume it's relevant to this post so I'll leave it here instead of making a new post.

NickGeek commented 3 years ago

We currently run with Angular 10 and Ivy, so I assume Angular 8 + Ivy is where the problem lies.

NoHara42 commented 3 years ago

@NickGeek Nevermind, after restarting the dev server the error disappeared.

Rlcolli4 commented 2 years ago

So we haven't had any issues yet with the newest version (8.2.1) however we get the following warning in Angular 13 with ivy about how ng-defer-load is not compiled with Ivy. I'm worried, due to Angular's current road map, that they may deprecate usability in future versions and it may cause problems.

NickGeek commented 1 year ago

60 compiles this package with Ivy, which should hopefully address your concerns @Rlcolli4. The lowest supported Angular version with v14 of this library will be Angular 12.