Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

remove argument-types inside translations for production bundle #13

Closed
1 of 3 tasks
ivanhofer opened this issue Mar 14, 2021 · 0 comments
Closed
1 of 3 tasks

remove argument-types inside translations for production bundle #13

ivanhofer opened this issue Mar 14, 2021 · 0 comments
Labels
help wanted Extra attention is needed optimization Things that could reduce bundle-size or make it more efficient

Comments

@ivanhofer
Copy link
Owner

ivanhofer commented Mar 14, 2021

If you use types inside your base-translations, the type-information is also part of the generated output. Since this information is only needed for the watcher to output better types, it can be omitted in production builds to save a few bytes from the bundle.

We could automatically remove all argument types for production

if you have a translation like this:

export const en = {
   HI: 'Hello {name:string}!'
   // other translations
}

it could be optimize to the following code:

export const en = {
   HI: 'Hello {name}!'
   // other translations
}

What needs to be done:

  • simple implementation, assuming all translation-strings live inside the index.ts file
  • advanced implementation, where all strings e.g. from imports inside the index.ts are considered
  • (optional) create an updated string-parser that doesn't try to parse the type from the translations to improve output size by a few bytes
@ivanhofer ivanhofer changed the title optimize output for production remove argument-types inside translations for production-bundle Mar 14, 2021
@ivanhofer ivanhofer added optimization Things that could reduce bundle-size or make it more efficient help wanted Extra attention is needed labels May 27, 2021
@ivanhofer ivanhofer changed the title remove argument-types inside translations for production-bundle remove argument-types inside translations for production bundle Jul 20, 2021
Repository owner locked and limited conversation to collaborators Oct 1, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
help wanted Extra attention is needed optimization Things that could reduce bundle-size or make it more efficient
Projects
None yet
Development

No branches or pull requests

1 participant