Closed codestitch closed 1 year ago
Same issue here. We use schematics to setup a new project in our company, took me a while to figure out the relation with Transloco. Now came to open an issue here and noticed somebody was 3hours faster than me 👍
Hoping for a fix soon :-)
@codestitch @TarsisDragomir I'll take a look
@codestitch @shaharkazaz it's not an issue anymore in angular 15 new generated project + transloco because there is no enableProdMode()
anymore in the main.ts, also it does not generate environment.ts files anymore.
https://angular.io/api/core/enableProdMode
now says 'Using this method is discouraged as the Angular CLI will set production mode when using the optimization option.'
=> this is most likely the reason why Transloco was changed from enviromnent.prodcution
to !isDevMode()
, because there are no environment files anymore by default
So for me no issue anymore, will just stick with a fixed version of transloco (4.2.0) for our angular 14 schematics run and for the 15 one we can safely use the current latest version.
@TarsisDragomir that's correct, that's why I made these changes.
I do think that we should at least add a comment in the docs or support the previous way as well.
I'll think about it.
Is there an existing issue for this?
Which Transloco package(s) are the source of the bug?
Transloco
Is this a regression?
No
Current behavior
Create angular 14 project with Jest. Then added transloco. Everything seems fine when serve in dev.
However, doing a prod build: ng build and then serving it in production (used http-server to check production), yields an error.
It seems that isDevMode() isn't working as expected. When tried to hardcode prodMode: true or false in translocoConfig(), it works! So, I reckon, could be isDevMode(). But I have no idea how to find a workaround or solution to this. As I thought this should work after enableProdMode(); is called in main.ts
Expected behavior
Deploying an angular 14 app w/ freshly installed transloco should work in production environment.
Please provide a link to a minimal reproduction of the bug
https://github.com/codestitch/ng14/tree/transloco
Transloco Config
Please provide the environment you discovered this bug in
Browser
No response
Additional context
No response
I would like to make a pull request for this bug
No