ngx-image-compress
ngx-image-compress copied to clipboard
Building a library alongside with Ivy and non-Ivy transpilation for retrocompatibility
@davi01100100 @gethinoakes @dfa1234 @byronigoe @davi01100100 I am using ngx-image-compress-legacy plugin for my angular project(Angular verision 8) . Plugin works in local host when ng serve. but it throws error when trying to take production build(ng build --prod).
ERROR in ./src/app/admin/transactions/edit-transaction-modal.component.ngfactory.js Module not found: Error: Can't resolve 'ngx-image-compress' in 'C:\angular\src\app\admin\transactions'
I import 'NgxImageCompressService' in my component.ts and module file like following. in component file
import { NgxImageCompressService } from ngx-image-compress-legacy;
constructor(){private imageCompress: NgxImageCompressService}
in module file
import {NgxImageCompressService} from "ngx-image-compress-legacy";
providers: [NgxImageCompressService]
Its Works in local(ng serve) but throw error in build(ng build --prod).
Successfull workaround:
diff --git a/packages/app/tsconfig.json b/packages/app/tsconfig.json
index f9f9325..95e65ed 100644
--- a/packages/app/tsconfig.json
+++ b/packages/app/tsconfig.json
@@ -12,7 +12,8 @@
],
"@ngxs/*": [
"./node_modules/@angular/*"
- ]
+ ],
+ "ngx-image-compress": ["node_modules/ngx-image-compress-legacy"]
},
},
"angularCompilerOptions": {
dfa1234 any updates on this? encountering same issue.
@heyjudemaldicas @bh @arunreghu it's not impossible to fix this very soon, but it's somewhat complicated. I don't want to work on 2 libraries. So I would just package 1 library with the ivy compilation and the non-ivy. But angular is not doing that out of the box (ng-packagr push you to drop old format...) Only solution would be to work on some script doing this for us. Like doing an angular 11 compilation (I tested it and 11 is fine) Then a angular 15 or 16 And mixing the 2 in one library I'm thinking a lot to do it soon, because supporting a very wide range of angular app is one of the goal of this library. And could be used elsewhere