remove argument-types inside translations for production bundle
ivanhofer opened this issue · 0 comments
ivanhofer commented
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