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

.11ty.js files are not rerun when dependencies are changed #2839

Closed
r-thomson opened this issue Mar 3, 2023 · 1 comment
Closed

.11ty.js files are not rerun when dependencies are changed #2839

r-thomson opened this issue Mar 3, 2023 · 1 comment

Comments

@r-thomson
Copy link

r-thomson commented Mar 3, 2023

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

@zachleat
Copy link
Member

Duplicate of #2838. This will ship with 2.0.1!

@zachleat zachleat added this to the Eleventy 2.0.1 milestone Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants