Skip to content

Commit 2084f0d

Browse files
committed
Support rebuild event from dev server
1 parent a5baa6a commit 2084f0d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Eleventy.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,8 @@ Arguments:
10721072
benchmark.before();
10731073
await this.#initWatchDependencies();
10741074
benchmark.after();
1075+
1076+
eventBus.on("eleventyDevServer.rebuild", async () => await this._watch());
10751077
}
10761078

10771079
// fetch from project’s package.json

src/EleventyServe.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import debugUtil from "debug";
44
import { Merge, DeepCopy, TemplatePath } from "@11ty/eleventy-utils";
55

66
import EleventyBaseError from "./Errors/EleventyBaseError.js";
7+
import EventBus from "./EventBus.js";
78
import ConsoleLogger from "./Util/ConsoleLogger.js";
89
import PathPrefixer from "./Util/PathPrefixer.js";
910
import checkPassthroughCopyBehavior from "./Util/PassthroughCopyBehaviorCheck.js";
@@ -181,6 +182,10 @@ class EleventyServe {
181182
// Static method `getServer` was already checked in `getServerModule`
182183
this._server = serverModule.getServer("eleventy-server", this.outputDir, this.options);
183184

185+
if ("setEventBus" in this._server) {
186+
this._server.setEventBus(EventBus);
187+
}
188+
184189
this.setAliases(this._aliases);
185190

186191
if (this._globsNeedWatching) {

0 commit comments

Comments
 (0)