For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/rspeedy/rspeedy.dev.hmr.md.
Rspeedy logo
Rspeedy
  • 简体中文
  • Home > @lynx-js/rspeedy > Dev > hmr

    Dev.hmr property

    Whether to enable Hot Module Replacement (HMR).

    Signature:

    hmr?: boolean | undefined;

    Default Value

    true

    Remarks

    By default, Rspeedy uses HMR as the preferred method to update modules. If HMR is disabled or cannot be used in certain scenarios, it will automatically fallback to Dev.liveReload.

    To completely disable both HMR and live reload, set both dev.hmr and dev.liveReload to false. Then, no WebSocket requests will be made to the dev server on the page, and the page will not automatically refresh when file changes.

    Example 1

    Disable HMR:

    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig({
      dev: {
        hmr: false,
      },
    })

    Example 2

    Disable both HMR and live reload:

    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig({
      dev: {
        hmr: false,
        liveReload: false,
      },
    })
    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。