Skip to content

Enable output hashing for Angular build assets #379

@mschilling

Description

@mschilling

Problem

The Angular build currently produces unhashed filenames (main.js, polyfills.js) instead of content-hashed ones (main.abc123.js). Combined with Firebase Hosting's max-age=3600 cache header on JS files, this means:

  • Users can be stuck on stale versions for up to 1 hour after a deploy
  • The Angular service worker (ngsw) has difficulty detecting new versions since filenames don't change
  • The "new version available" banner rarely triggers on mobile devices

Proposed Solution

Enable outputHashing: "all" in the Angular build configuration for test and production targets. This produces filenames like main.d4d9f2f.js which:

  • Are safe to cache indefinitely (content changes = new filename)
  • Allow index.html (which references the hashed filenames) to be the only file that needs revalidation
  • Work correctly with ngsw-config.json patterns (already uses /main*.js, /polyfills*.js, /chunk-*.js)

Files to Change

  • apps/frontend/app/project.json — add outputHashing: "all" to test/production build configurations
  • Optionally: firebase.json — set longer cache TTL for hashed assets, shorter for index.html

Context

Discovered during PR #378 (notifications + FCM push). Deploying new versions repeatedly showed that phones and browsers weren't picking up changes due to CDN-cached unhashed JS files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement to existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions