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/lynxtron/api/@lynx-js/lynxtron-dev-plugins/index.md.
  • 简体中文
  • @lynx-js/lynxtron-dev-plugins

    @lynx-js/lynxtron-dev-plugins 提供开发期构建插件,用于协调 RSpeedy、Rspack 和 Lynxtron 进程启动。

    RSpeedy Dev Ready 插件

    @lynx-js/lynxtron-dev-plugins/rspeedy 引入 pluginRspeedyDevReady()

    import { pluginRspeedyDevReady } from '@lynx-js/lynxtron-dev-plugins/rspeedy';
    
    export default {
      plugins: [pluginRspeedyDevReady()],
    };

    该插件在 RSpeedy dev server 启动和首次编译完成时输出可被其他开发脚本识别的状态:

    输出 / 文件说明
    RSPEEDY_DEV_SERVER:<port>dev server 启动后输出端口。
    RSPEEDY_READY首次 dev 编译完成后输出。
    .tmp/dev-ready.rspeedy.json首次 dev 编译完成后写入 { "ready": true },供等待脚本读取。

    dev-ready-rspeedy CLI

    dev-ready-rspeedy 会等待 .tmp/dev-ready.rspeedy.json 出现并确认 ready: true,成功后删除该文件并输出 dev-ready-speedy。默认等待超时时间为 300 秒。

    npx dev-ready-rspeedy

    Rspack Lynxtron 插件

    @lynx-js/lynxtron-dev-plugins/rspack 引入 pluginLynxtron()

    import { pluginLynxtron } from '@lynx-js/lynxtron-dev-plugins/rspack';
    
    export default {
      plugins: [
        pluginLynxtron({
          entry: './dist/main/main.js',
          isDev: true,
          args: ['--inspect=9222'],
        }),
      ],
    };

    每次 Rspack 编译完成后,插件会启动或重启 Lynxtron 进程。

    选项类型说明
    entrystring必填,传给 Lynxtron CLI 的应用入口。
    isDevboolean开发模式标记;为 true 时关闭 minimize。插件会将 Rspack 的 optimization.nodeEnv 设为 false
    argsstring[]传给 Lynxtron CLI 的额外参数。
    envRecord<string, string>传给 Lynxtron 子进程的额外环境变量。
    commandstringLynxtron 启动命令,默认是 lynxtron
    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。