ngx-image-compress icon indicating copy to clipboard operation
ngx-image-compress copied to clipboard

Building a library alongside with Ivy and non-Ivy transpilation for retrocompatibility

Open arunreghu opened this issue 2 years ago • 4 comments

@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).

arunreghu avatar Oct 21 '22 05:10 arunreghu

Screenshot_32

arunreghu avatar Oct 21 '22 06:10 arunreghu

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": {

bh avatar May 24 '23 15:05 bh

dfa1234 any updates on this? encountering same issue.

heyjudemaldicas avatar Jun 14 '23 10:06 heyjudemaldicas

@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

dfa1234 avatar Jun 16 '23 06:06 dfa1234

This is done.

Please use

npm install [email protected]

dfa1234 avatar Jul 22 '24 16:07 dfa1234