• Mark Florian's avatar
    Add LRU-like behaviour to incremental compilation · 3a7a35fb
    Mark Florian authored
    This adds least-recently-used-cache-like behaviour to the incremental
    webpack compiler. The `DEV_SERVER_INCREMENTAL_TTL` environment variable
    now determines the number of days that page bundles are considered
    "recent", and should be eagerly compiled. This number represents the
    trade-off between lazy/eager compilation versus low/high memory
    consumption of the webpack development server. A higher number means
    fewer pages needing to be compiled on demand, at the cost of higher
    memory consumption. A lower number means lower memory consumption, at
    the cost of more pages being compiled on demand. A value of `0` means
    that all pages in your history, regardless of how long ago you visited
    them, are eagerly compiled.
    
    This also makes the compiler record a history of visited pages even when
    disabled, so that if and when it _is_ enabled, that history can still be
    used to inform the LRU cache.
    
    The history-recording function is explicitly disabled in the case that
    webpack is running in CI.
    
    Part of https://gitlab.com/gitlab-org/gitlab/-/issues/300412.
    3a7a35fb
webpack.config.js 22.3 KB