e9b58a62c0
The previous PR enabled `--localize` on the production build, so the
output structure became `dist/apps/portal-shell/browser/{en,fr}/`
with no top-level `index.html`. Two CI breakages followed:
- `nx run portal-shell:serve-static` (lhci's `startServerCommand`)
was configured with `spa: true`. The `@nx/web:file-server` executor
reads that as "copy `<staticFilePath>/index.html` to `404.html` for
SPA fallback". The source file no longer exists, so the executor
crashes with `ENOENT … copyfile … index.html` and never opens the
port.
- Even if the server had started, `lighthouserc.js` was targeting
`http://localhost:4200/` which produces an `http-server` directory
listing under the new layout. Lighthouse would have run against
that, not the SPA.
Fixes:
- Drop `spa: true` from the `serve-static` target. The executor no
longer attempts the missing copy. Deep-link fallback in production
is the reverse proxy's job (it routes `/{en,fr}/anything` to the
matching `index.html`); `nx serve-static` is only used for the
perf gate and for local prod-build inspection of the entry points.
For deep-link testing in dev, `nx serve` is the right tool.
- Update `lighthouserc.js` `url` list to `['http://localhost:4200/fr/',
'http://localhost:4200/en/']`, matching the directive in ADR-0019
that both locales clear the same performance bar.
120 lines
3.0 KiB
JSON
120 lines
3.0 KiB
JSON
{
|
|
"name": "portal-shell",
|
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
"projectType": "application",
|
|
"prefix": "app",
|
|
"sourceRoot": "apps/portal-shell/src",
|
|
"tags": ["scope:portal-shell", "type:app"],
|
|
"i18n": {
|
|
"sourceLocale": {
|
|
"code": "en",
|
|
"baseHref": "/en/"
|
|
},
|
|
"locales": {
|
|
"fr": {
|
|
"translation": "apps/portal-shell/src/locale/messages.fr.xlf",
|
|
"baseHref": "/fr/"
|
|
}
|
|
}
|
|
},
|
|
"targets": {
|
|
"build": {
|
|
"executor": "@angular/build:application",
|
|
"outputs": ["{options.outputPath}"],
|
|
"options": {
|
|
"outputPath": "dist/apps/portal-shell",
|
|
"browser": "apps/portal-shell/src/main.ts",
|
|
"polyfills": ["@angular/localize/init"],
|
|
"tsConfig": "apps/portal-shell/tsconfig.app.json",
|
|
"inlineStyleLanguage": "scss",
|
|
"assets": [
|
|
{
|
|
"glob": "**/*",
|
|
"input": "apps/portal-shell/public"
|
|
}
|
|
],
|
|
"styles": ["apps/portal-shell/src/styles.css"]
|
|
},
|
|
"configurations": {
|
|
"production": {
|
|
"localize": ["en", "fr"],
|
|
"budgets": [
|
|
{
|
|
"type": "initial",
|
|
"maximumWarning": "1mb",
|
|
"maximumError": "1mb"
|
|
},
|
|
{
|
|
"type": "anyScript",
|
|
"maximumWarning": "300kb",
|
|
"maximumError": "300kb"
|
|
},
|
|
{
|
|
"type": "anyComponentStyle",
|
|
"maximumWarning": "5kb",
|
|
"maximumError": "6kb"
|
|
},
|
|
{
|
|
"type": "bundle",
|
|
"name": "styles",
|
|
"maximumWarning": "150kb",
|
|
"maximumError": "150kb"
|
|
}
|
|
],
|
|
"outputHashing": "all"
|
|
},
|
|
"development": {
|
|
"optimization": false,
|
|
"extractLicenses": false,
|
|
"sourceMap": true
|
|
}
|
|
},
|
|
"defaultConfiguration": "production"
|
|
},
|
|
"extract-i18n": {
|
|
"executor": "@angular/build:extract-i18n",
|
|
"options": {
|
|
"buildTarget": "portal-shell:build",
|
|
"outputPath": "apps/portal-shell/src/locale",
|
|
"outFile": "messages.xlf"
|
|
}
|
|
},
|
|
"serve": {
|
|
"continuous": true,
|
|
"executor": "@angular/build:dev-server",
|
|
"configurations": {
|
|
"production": {
|
|
"buildTarget": "portal-shell:build:production"
|
|
},
|
|
"development": {
|
|
"buildTarget": "portal-shell:build:development"
|
|
}
|
|
},
|
|
"defaultConfiguration": "development"
|
|
},
|
|
"lint": {
|
|
"executor": "@nx/eslint:lint"
|
|
},
|
|
"test": {
|
|
"executor": "@angular/build:unit-test",
|
|
"options": {
|
|
"watch": false
|
|
},
|
|
"configurations": {
|
|
"watch": {
|
|
"watch": true
|
|
}
|
|
}
|
|
},
|
|
"serve-static": {
|
|
"continuous": true,
|
|
"executor": "@nx/web:file-server",
|
|
"options": {
|
|
"buildTarget": "portal-shell:build",
|
|
"port": 4200,
|
|
"staticFilePath": "dist/apps/portal-shell/browser"
|
|
}
|
|
}
|
|
}
|
|
}
|