发布

  • fix(nx-dev): fix double-counting and exclude assets from page tracking (#34286)

    frostbyte_neo 发布于 2026-02-02 17:17:32 +00:00

    Current Behavior

    1. track-asset-requests runs twice per request due to redundant path
      patterns:
      path: ["/*.txt", "/**/*.txt", "/*.md", "/**/*.md"]
      

    The /**/* pattern already matches root level files, so /* is
    redundant.

    1. track-page-requests runs on many asset requests even though it
      only tracks HTML page views:
      • Font files: /docs/fonts/*.woff2, /docs/*.woff
      • Images: /docs/*.svg, /docs/*.png, /docs/og/*
      • Pagefind search index: /docs/pagefind/*

    Expected Behavior

    1. Asset tracking should fire only once per request
    2. Page tracking should exclude all non-HTML assets at Netlify level
      (zero compute)

    Changes

    track-asset-requests.ts

    Simplified path patterns:

    path: ["/**/*.txt", "/**/*.md"]
    

    track-page-requests.ts

    Added comprehensive exclusions:

    Category Exclusions
    Images .svg, .png, .jpg, .jpeg, .gif, .webp, .ico,
    /images/*, /og/*
    Fonts /fonts/*, .woff, .woff2
    Search /pagefind/*

    Related Issue(s)

    Fixes DOC-395

    下载附件