mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
fix: handle non-string outputPath in html-transformer override
outputPath can be `false` for pages without output. Optional chaining (?.) only guards null/undefined, not booleans — use typeof check instead. Confab-Link: http://localhost:8080/sessions/0b241cd6-aff2-4fec-853c-2b5a61e61946
This commit is contained in:
@@ -342,7 +342,7 @@ export default function (eleventyConfig) {
|
||||
// overwrites via addTransform) with a pre-check that avoids the full PostHTML
|
||||
// parse/serialize cycle (~3ms/page) for image-free pages.
|
||||
eleventyConfig.addTransform("@11ty/eleventy/html-transformer", async function(content) {
|
||||
if (this.outputPath?.endsWith(".html") && !content.includes("<img")) {
|
||||
if (typeof this.outputPath === "string" && this.outputPath.endsWith(".html") && !content.includes("<img")) {
|
||||
// Safety: if URL transform callbacks exist (they modify <a>, <link>, etc.)
|
||||
// we must still run the full pipeline even without images.
|
||||
const hasUrlCallbacks = eleventyConfig.htmlTransformer.getCallbacks("html", this).length > 0;
|
||||
|
||||
Reference in New Issue
Block a user