zyra / ionic-image-loader

Ionic 2+ Component that loads images in a background thread and caches them for later use
MIT License
436 stars 137 forks source link

I can not use ionic-image-loader in ionic 5 over #283

Open tinycoding5 opened 4 years ago

tinycoding5 commented 4 years ago

ionic-angular plugin updated to @ionic/angular. So i can not use this ionic-image-loader plugin. I have replace import { } from 'ionic-angular' to '@ionic/angular' in node module. But this is not good way. And then that made many errors. So ionic-image-loader plugin version need to update, in my opinion

tinycoding5 commented 4 years ago

After I have replace ionic-angular to @ionic/angular, i have got error. Here is error; Uncaught Error: Can't resolve all parameters for ImageLoader: ([object Object], ?, [object Object], [object Object]). at syntaxError (vendor-es2015.js:12780) at CompileMetadataResolver._getDependenciesMetadata (vendor-es2015.js:30771) at CompileMetadataResolver._getTypeMetadata (vendor-es2015.js:30666) at CompileMetadataResolver._getInjectableTypeMetadata (vendor-es2015.js:30884) at CompileMetadataResolver.getProviderMetadata (vendor-es2015.js:30893) at providers.forEach (vendor-es2015.js:30831) at Array.forEach () at CompileMetadataResolver._getProvidersMetadata (vendor-es2015.js:30791) at flattenAndDedupeArray.forEach (vendor-es2015.js:30422) at Array.forEach ()

How can I solve this issue?

benzata commented 4 years ago

I could not manage to make it work either.. I believe it is not working for Ionic 5. Can someone please confirm?

ernes128 commented 4 years ago

I could not manage to make it work either.. I believe it is not working for Ionic 5. Can someone please confirm?

I'm not from the team who developed this package but I can confirm that is not working on Ionic 5. Since what I see the author has this repo abandoned I cloned it and tried to update the dependencies to make it compatible with angular 9 and ionic 5 but there are a lot of deprecations and breaking changes between versions.

The last angular stable version that this package supports is Angular 5. Starting to Angular 6 and above you will start getting warning and errors about deprecations or references not found in the packages.

Hope at least give you some idea about the status of the project. Maybe if there's someone who has a lot of time to migrate it to support the latest Angular and Ionic version this repo could back to live again.

lestrell commented 4 years ago

Hi @ernes128,

This is hacky, but you can run this script on post install or pre build: ` const fs = require("fs");

const filePaths = [ "./node_modules/ionic-image-loader/dist/providers/image-loader.js", "./node_modules/ionic-image-loader/dist/image-loader.module.js", "./node_modules/ionic-image-loader/dist/providers/image-loader.d.ts",
]; let replace = "'@ionic-native/file'"; let replaceWith = "'@ionic-native/file/ngx'";

for(let filePath of filePaths) { let lang = fs.readFileSync(filePath, "utf8"); lang = lang.replace(replace, replaceWith); fs.writeFileSync(filePath, lang, "utf8") }

console.log("Done!")

`