-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HOLD for payment 2025-01-22] [$250] Update react-native-qrcode-svg to not use text-decoding #54096
Comments
Hey @mountiny, Edu from Callstack, I will be working on this one |
Tasks
|
Triggered auto assignment to @isabelastisser ( |
Job added to Upwork: https://www.upwork.com/jobs/~021869155133024534590 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia ( |
I confirmed that removing the line:
our app will tree shake that lib and won't be on the final bundle. Now I'm looking into a way to adding that line for old RN versions |
Hi @gedu, I see you are working on the issue already, I saw it yesterday and wanted to experiment with it before commenting. Feel free to continue on with my PR! |
📣 @AbdulrhmnGhanem! 📣
|
@AbdulrhmnGhanem Hey, thanks for your PR. The main idea of the issue is to remove the text-encoder to reduce the bundle size, your approach always keeps the lib into the bundle. So it won't work. |
It doesn't get bundled unless the library users install it. I am curious
though if there's a solution that doesn't require modifying metro config
for each app.
…On Thu, Dec 19, 2024, 10:00 PM edug ***@***.***> wrote:
@AbdulrhmnGhanem <https://github.com/AbdulrhmnGhanem> Hey, thanks for
your PR. The main idea of the issue is to remove the text-encoder to reduce
the bundle size, your approach always keeps the lib into the bundle. So it
won't work.
—
Reply to this email directly, view it on GitHub
<#54096 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AI3OMSO7HIPSBPW7MGJLIQD2GMQWNAVCNFSM6AAAAABTRQ27ZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJVGY3DSMRQHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@mountiny I created a PR using the metro solution, on Exfy app the only thing we have to do is increase the version and that's all. |
FYI, I will be OOO from Dec 23 to Jan 6, so please reassign the issue to another team member for urgency, IF needed. |
@gedu can you link the pr here please? |
I'm looking into a possible Example App issue, and will continue updating the version @mountiny I still see that the last version is |
Fixing the publishing flow that seems broken |
@gedu @parasharrajat @isabelastisser @mountiny this issue is now 4 weeks old, please consider:
Thanks! |
PR created: #55080 |
@gedu anything else left to do here? |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.85-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2025-01-22. 🎊 For reference, here are some details about the assignees on this issue:
|
@parasharrajat @isabelastisser @parasharrajat The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
All good here |
So only payments to @parasharrajat |
This is a new feature not bug. Let's fix the labels. |
Regression Test Steps
Do you agree 👍 or 👎 ? |
I think we should already have tests like this |
Current assignee @isabelastisser is eligible for the NewFeature assigner, not assigning anyone new. |
Payment summary: @parasharrajat requires payment through NewDot Manual Requests $250 for C+ review |
Payment requested as per #54096 (comment) |
Background
react-native-qrcode-svg relies on the text-encoding library to provide TextDecoder and TextEncoder functionality, which is essential for encoding and decoding text data. However, starting with React Native 0.75, these functionalities are natively supported, making the inclusion of text-encoding redundant for modern environments.
Despite this, the library currently includes text-encoding in all builds, regardless of the React Native version. This results in an unnecessary increase in app bundle size, particularly for developers using React Native 0.75 or higher, where native support for TextDecoder and TextEncoder is already available. This behavior impacts performance and resource usage, especially for applications targeting modern devices.
Reference the relevant issue and commit:
• Issue: Expensify/react-native-qrcode-svg#199
• Commit: 53f1c5f
Problem
The react-native-qrcode-svg library always includes the text-encoding library, adding approximately 600KB to the app bundle size. This is unnecessary for React Native 0.75+ environments, where TextDecoder and TextEncoder are natively supported, leading to inefficiencies in modern applications.
Solution
Update react-native-qrcode-svg to conditionally include the text-encoding library based on the React Native version or the availability of native TextDecoder and TextEncoder. This can be achieved through the following steps:
Version Check:
○ Add conditional logic to detect if the app is running on React Native 0.75 or higher.
○ Exclude the text-encoding library from the bundle if native support for TextDecoder and TextEncoder is available.
Metro Serializer Optimization:
○ Use tools like Metro Serializer Esbuild to further optimize the bundle and ensure unused dependencies like text-encoding are excluded.
Slack: https://expensify.slack.com/archives/C05LX9D6E07/p1734018386310029
Note: Given that we are on 0.75, we can remove text-encoding lib
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @isabelastisserThe text was updated successfully, but these errors were encountered: