Load Language js package in dist Version
Hi everybody,
My problem happen in the dist Version, when I upload the folder to my subdirectory in my web hosting. When I run localhost:4200 everything works perfectly, all tthe links; but whe I generated the dist version not so well,
First of all, my app run over a Directory (subfolder: URL/myfolder), in this way I run:
ng build --prod --base-href /myfolder/ --deploy-url /myfolder/
After I uploaded the dist folder, occur the error: "error load URL/assets/i18n/en.json" "error load URL/assets/i18n/es.json" So, The language buttons does not work,
What kind of changes I need to do, in order to havethis files working?, I have tried modify some files with the word "myfolder" angular.json but not succeded.
My second problem, is simple, When I refresh the website, shows and 404 error, I read about it , and It supose will fix using the --base-href attribute, due to the browser try to load URL/somoething and not URL/myfolder/index.html ?
how can I fix this too?
I appreciate your help.
For language issue just look at the package.json file For 404 issue use url rewrite and redirect it to index.html page We do have configuration file for apache
Hi, appreciate your answer,
the problem would be this: the Browser engine want to load URL/assets/i18n/es.json:1 Failed but behind the url all the resources are loading from URL/myfolder/assets/i18n/en.json.
in For language issue just look at the package.json file in this part: "@ngx-translate/core": "11.0.0", "@ngx-translate/http-loader": "4.0.0",
I think maybe I have to change something in "configurations": { "production": {... in angular.json
I doubt about the option to compile: --deploy-url /myfolder/ because it is applied to the assets/images
assets/css but not for assets/i18n
thank you
For q quick fix you can use env variable For production use full path(sub folde path + assets/i18n/en.json) In development mode use path as it is