.11ty.js files are not rerun when dependencies are changed
r-thomson opened this issue · comments
Operating system
macOS 13.2.1
Eleventy
2.0.0
Describe the bug
When using .11ty.js
files which import other .js
files, changes made to the .js
files are not reflected in the rendered templates when using the --watch
/--serve
flags.
From looking at the console, 11ty is definitely aware of the changes to the .js
files, and they are re-imported and re-run. The .11ty.js
file's render function gets re-run but not re-imported, so it still has the old version of its .js
dependencies.
(This probably applies to more file types, this is just what I’ve tested so far)
Reproduction steps
Run npx eleventy --serve
and make changes to part.js. Even refreshing the page does not reflect changes.
eleventy.config.js
module.exports = function (eleventyConfig) {
return {
dir: {
input: "src",
output: "dist",
},
};
};
src/index.11ty.js
const part = require("./part.js");
module.exports = function (data) {
return `
<!DOCTYPE html>
<html lang="en">
<body>
<p>Index page</p>
${part()}
</body>
</html>
`;
};
src/_includes/part.js
module.exports = function () {
return "<p>Lorem ipsum</p>";
};
Expected behavior
No response
Reproduction URL
No response
Screenshots
No response
Duplicate of #2838. This will ship with 2.0.1!