Skip to content

Commit a5baa6a

Browse files
committed
Add support for cache: false to Custom compileOptions. Also informs dynamic import of JavaScript files. Fixes #3737
1 parent e1d431d commit a5baa6a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Engines/Custom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default class CustomEngine extends TemplateEngine {
1717
this._defaultEngine = undefined;
1818

1919
// Enable cacheability for this template
20-
if (this.entry?.compileOptions?.cache) {
20+
if (this.entry?.compileOptions?.cache !== undefined) {
2121
this.cacheable = this.entry.compileOptions.cache;
2222
} else if (this.needsToReadFileContents()) {
2323
this.cacheable = true;

src/Engines/JavaScript.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ export default class JavaScript extends TemplateEngine {
9292
mod = this.eleventyConfig.userConfig.virtualTemplates[relativeInputPath].content;
9393
} else {
9494
let isEsm = this.eleventyConfig.getIsProjectUsingEsm();
95+
let cacheBust = !this.cacheable || !this.config.useTemplateCache;
9596
mod = await EleventyImport(inputPath, isEsm ? "esm" : "cjs", {
96-
cacheBust: !this.config.useTemplateCache,
97+
cacheBust,
9798
});
9899
}
99100

0 commit comments

Comments
 (0)