From 96be962eff33209a34868513d4aa4c037a3ef4f8 Mon Sep 17 00:00:00 2001 From: Antony Gelberg Date: Mon, 30 Oct 2023 00:27:43 +0000 Subject: [PATCH] Support rebuild event from dev server --- src/Eleventy.js | 2 ++ src/EleventyServe.js | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/Eleventy.js b/src/Eleventy.js index 1131f9d94..ee8ad0e72 100644 --- a/src/Eleventy.js +++ b/src/Eleventy.js @@ -952,6 +952,8 @@ Arguments: benchmark.before(); await this._initWatchDependencies(); benchmark.after(); + + eventBus.on("eleventyDevServer.rebuild", async () => await this._watch()); } get isEsm() { diff --git a/src/EleventyServe.js b/src/EleventyServe.js index 4a4606e4d..475c0fd7b 100644 --- a/src/EleventyServe.js +++ b/src/EleventyServe.js @@ -3,6 +3,7 @@ import EleventyDevServer from "@11ty/eleventy-dev-server"; import debugUtil from "debug"; import EleventyBaseError from "./EleventyBaseError.js"; +import EventBus from "./EventBus.js"; import ConsoleLogger from "./Util/ConsoleLogger.js"; import PathPrefixer from "./Util/PathPrefixer.js"; import merge from "./Util/Merge.js"; @@ -165,6 +166,10 @@ class EleventyServe { // Static method `getServer` was already checked in `getServerModule` this._server = serverModule.getServer("eleventy-server", this.outputDir, this.options); + if ("setEventBus" in this._server) { + this._server.setEventBus(EventBus); + } + this.setAliases(this._aliases); }