For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/api/packages/rspeedy/interfaces/BuildCache.md.
Lynx
  • English
  • Interface: BuildCache

    Beta

    Enable or configure persistent build cache.

    Remarks

    This feature is experimental and may be changed in the future.

    Properties

    buildDependencies?

    optional buildDependencies?: string[]

    Beta

    An array of files containing build dependencies. Rspack will use the hash of each of these files to invalidate the persistent cache.

    Default Value

    ['package.json', 'tsconfig.json' (or source.tsconfigPath), '.env', '.env.*', 'tailwindcss.config.*']; when using the Rspeedy CLI with performance.buildCache enabled, the loaded lynx.config.* file is also added.

    Example

    Add postcss.config.js to the build dependencies.

    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig({
      performance: {
        buildCache: {
          buildDependencies: ['postcss.config.js'],
        },
      },
    })

    cacheDigest?

    optional cacheDigest?: (string | undefined)[]

    Beta

    Add additional cache digests, the previous build cache will be invalidated when any value in the array changes.

    Default Value

    undefined

    Example

    Add process.env.SOME_ENV to the cache digest.

    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig({
      performance: {
        buildCache: {
          cacheDigest: [process.env.SOME_ENV],
        },
      },
    })

    cacheDirectory?

    optional cacheDirectory?: string

    Beta

    The output directory of the cache files.

    Default Value

    'node_modules/.cache'
    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.