-
Notifications
You must be signed in to change notification settings - Fork 902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular i18n, baseHref, and optimized images #5774
Conversation
jamesdaniels
commented
May 2, 2023
•
edited
edited
- Add support for Angular i18n
- Add support for Angular baseUrl
- Move context logic into utils
- Shell out all targets, best not to have conditional logic
- deploy.serveOptimizedImages trips requirement for backend
- Validate i18n locales
- Use baseUrl in rewrite (ng & nextjs)
- Angular needs an i18n root of "/"—I only departed from this with NextJS to aid debugging
- Add Angular to the WF integration test
- Bump firebase-frameworks version
- Give sharp a version range
- Reset env vars and memos after prepare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## next #5774 +/- ##
==========================================
- Coverage 55.25% 55.10% -0.15%
==========================================
Files 331 332 +1
Lines 22793 22878 +85
Branches 4655 4679 +24
==========================================
+ Hits 12594 12607 +13
- Misses 9077 9147 +70
- Partials 1122 1124 +2
☔ View full report in Codecov by Sentry. |
src/frameworks/angular/index.ts
Outdated
const wantsBackend = !!serverTarget; | ||
|
||
return { wantsBackend }; | ||
const wantsBackend = !!serverTarget || ngOptimizedImage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could log the reasons for backend as we do with Next.js?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolutely, i expect more reasons as Angular is on a roll lately
Co-authored-by: Leonardo Ortiz <leo@monogram.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamesdaniels what's a working angular.json
file to test this? I'm using a basic i18n set up and getting an error (Error: Failed to lookup view "index" in views directory
) when running with firebase emulators:start
, it is working when running with ng serve
.
@chalosalvador the failure is due to your server.ts not being adapted for localization, you'll need to make the following changes: // The Express app is exported so that it can be used by serverless Functions.
export function app(locale: string): express.Express {
const server = express();
const distFolder = join(process.cwd(), `dist/hosting/browser/${locale}`); Note the local string being passed into app and used for the distFolder. We should def document this & set it up out of box with the starter template. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I was able to deploy Angular i18n projects in both MacOS and Windows. Found an issue in Windows with spawn
and pushed a fix, all working now!
The error messages also helped me fix my project without leaving the terminal, amazing job @jamesdaniels!
* Add support for Angular i18n * Add support for Angular baseUrl * Move context logic into utils * Shell out all targets, best not to have conditional logic * deploy.serveOptimizedImages trips requirement for backend * Validate i18n locales * Use baseUrl in rewrite (ng & nextjs) * Angular needs an i18n root of "/"—I only departed from this with NextJS to aid debugging * Add Angular to the WF integration test * Bump firebase-frameworks version * Give sharp a version range * Reset env vars and memos after prepare