Since the update to Angular 18, my bi-lingual website is broken.
After the update it removes the tsconfig.server.json and the related scripts that I was running to serve both languages, it also removed a section from angular.json.
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/morefont-v5/server",
"main": "server.ts",
"tsConfig": "tsconfig.server.json",
"sourceMap": true,
"optimization": false
},
"configurations": {
"production": {
"outputHashing": "media",
"localize":true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"sourceMap": false,
"optimization": true
}
},
"defaultConfiguration": ""
}
I followed this guide for implementing i18n but since the update there is a lot of errors.
I have tried to create back the tsconfig.server.json but the server/server/mjs is not generated with the build anymore.
my tsconfig.server.json manually replaced in the code after the upgrade
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.app.json",
"compilerOptions": {
"outDir": "./out-tsc/server",
"target": "es2016",
"types": [
"node",
"@angular/localize"
]
},
"files": [
"src/main.server.ts",
"server.ts"
],
"angularCompilerOptions": {
"entryModule": "./src/app/app.server.module#AppServerModule"
}
}
my proxy server look like this
const express = require("express");
const path = require("path");
const getTranslatedServer = (lang) => {
const distFolder = path.join(
process.cwd(),
`dist/morefont-v5/server/${lang}`
);
const server = require(`${distFolder}/main.js`);
return server.app(lang);
};
function run() {
const port = 4000;
// Start up the Node server
const appFr = getTranslatedServer("fr");
const appEn = getTranslatedServer("en");
const server = express();
server.use("/fr", appFr);
server.use("/en", appEn);
server.use("", appEn);
server.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
});
}
run();
When I run the serve it crash since server.mjs is not generated anymore