Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rebuild event from dev server #3085

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,8 @@ Arguments:
benchmark.before();
await this._initWatchDependencies();
benchmark.after();

eventBus.on("eleventyDevServer.rebuild", async () => await this._watch());
}

get isEsm() {
Expand Down
5 changes: 5 additions & 0 deletions src/EleventyServe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
}

Expand Down