aeirola / react-native-svg-asset-plugin

Asset plugin for importing SVG images in React Native
https://www.npmjs.com/package/react-native-svg-asset-plugin
MIT License
68 stars 9 forks source link

Metro idles after bundling #73

Open maxammann opened 2 years ago

maxammann commented 2 years ago

The command yarn react-native bundle --platform android --entry-file index.ts --bundle-output out idles for at least a few minutes after it finished.

I found out that the following lines are responsible for this: https://github.com/aeirola/react-native-svg-asset-plugin/blob/master/src/cache.js#L63-L67

This was introduced here: https://github.com/aeirola/react-native-svg-asset-plugin/pull/49/files

When building in release mode there should be no cleanup task scheduled.

maxammann commented 2 years ago

The workaround is to revert to 0.4.0

jeremy303 commented 4 months ago

@aeirola This is such a great plugin. What do you think the right approach is to fix this? I don't have a good feel for what that would look like, so I've just patched my local copy to skip the cleanup-- but I'd love to see this properly fixed. Thanks!

aeirola commented 4 months ago

Hi, sorry for not reacting to this earlier. Not really using react native anymore, so maintenance of the plugin is unfortunately on hold at the moment.

I know that the cache functionality is a bit fragile, and apparently doesn't work properly in all metro bundling scenarios. Would definitely be good to improve on that.

While I don't have time to fix it myself, I'll be happy to accept PRs that improve the situation. Some possible approaches for solving the issue come to mind:

If anyone is familiar with the latest developments in react-native and metro, please share your thoughts on what kind of a solution would be suitable here. I unfortunately won't have time to familiarise myself with the current state of the react-native toolchain