I am using my application in three languages using @angular/localize and I am having trouble in the time take to deploy the server. The reason being that even though all locale use same assets, they are downloaded and they deployed for each one of them.
That's why I am trying to remove assets for all but one locale. And I did that using script and removing the folder itself. But now I want other locale to use the assets from en-US and not say 404 not found like they're doing right now.
Is there any way to achieve this currently?
My locale configuration is this:
"i18n": {
"sourceLocale": "en-US",
"locales": {
"fr": "src/locale/messages.fr.xtb",
"pt": "src/locale/messages.pt.xtb",
"hi": "src/locale/messages.hi.xtb",
}
},
And to check the serving I am using this configuration:
"prod-hi": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"deleteOutputPath": false,
"assets": [],
"localize": ["hi"]
},
in your 'local' configuation, you could use assets configuration to ignore/remove all assets for unwanted ones. and still outputing to asset folder:
"assets": [
{
"glob": "**/*",
"input": "src/assets/",
"ignore": [
"**/hi/*",
"**/en/*"
],
"output": "/assets/"
}
]
This has been taken from : https://angular.io/guide/workspace-config#assets-configuration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With