Skip to content

Commit

Permalink
Write templates synchronously (#3272)
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat authored Jun 10, 2024
2 parents 9d93d72 + b02eb19 commit 1beb9dd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Template.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import ReservedData from "./Util/ReservedData.js";
import TransformsUtil from "./Util/TransformsUtil.js";

const { set: lodashSet, get: lodashGet } = lodash;
const writeFile = util.promisify(fs.writeFile);
const fsStat = util.promisify(fs.stat);

const debug = debugUtil("Eleventy:Template");
Expand Down Expand Up @@ -719,7 +718,9 @@ class Template extends TemplateContent {
let templateBenchmark = this.bench.get("Template Write");
templateBenchmark.before();

await writeFile(outputPath, finalContent);
// Note: This deliberately uses the synchronous version to avoid
// unbounded concurrency: https://github.com/11ty/eleventy/issues/3271
fs.writeFileSync(outputPath, finalContent);

templateBenchmark.after();
this.writeCount++;
Expand Down

0 comments on commit 1beb9dd

Please sign in to comment.