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

Bug: config dependencies changes don’t apply during serve/watch #2864

Closed
dwkns opened this issue Feb 16, 2023 · 5 comments
Closed

Bug: config dependencies changes don’t apply during serve/watch #2864

dwkns opened this issue Feb 16, 2023 · 5 comments
Labels
bug: --serve restart Changes to projects shouldn’t need to restart dev server

Comments

@dwkns
Copy link

dwkns commented Feb 16, 2023

Consider:

// eleventy.config.js
const data = require("./data.js");
module.exports = (eleventyConfig) => {
  console.log(`[ data ]:`, data); // equivalent of doing something with the data
 
  return {
    dir: {
      input: "src",
      output: "dist",
      layouts: "_layouts",
      data: "_data",
    },
  };
};

And

// data.js
module.exports = "this is a test";

It is super annoying that every time you make a change in data.js you have to:

  • Restart the dev server; or
  • Also make a change in eleventy.config.js
    If you don't then eleventy.config.js doesn't see the change in the dependent file (data.js)

Ideally you'd be able to add something like:

eleventyConfig.setServerOptions({
...
alwaysProcess: [ 'eleventy.config.js', 'some-other-dependency.js']
});

It would certainly make plugin development a lot easier.

Thoughts?

@bobmonsour
Copy link

There appears to be a "watch" option on the dev server where you can specify an array of files to watch which will trigger a server update. See here:

https://www.11ty.dev/docs/dev-server/#options

@zachleat
Copy link
Member

This should happen automatically in Eleventy. We’ve fixed a few bugs on this recently, what’s the newest version you’ve tested on?

@zachleat zachleat transferred this issue from 11ty/eleventy-dev-server Mar 13, 2023
@zachleat zachleat added the bug: --serve restart Changes to projects shouldn’t need to restart dev server label Mar 13, 2023
@zachleat
Copy link
Member

@dwkns
Copy link
Author

dwkns commented Mar 13, 2023

Tested on 2.0.0
Minimal repo to reproduce here:
https://github.com/dwkns/eleventy-issue-2864

I saw this issue which suggests you've made changes for 2.0.1, but I'm not sure how I can test against that.

@zachleat zachleat added this to the Eleventy 2.0.1 milestone Mar 17, 2023
@zachleat
Copy link
Member

I was able to reproduce this on 2.0.0 and can confirm that 2.0.1 fixes it!

@zachleat zachleat changed the title Feature Request: Option to supply an array of files that are reloaded on ANY file change. Bug: config dependencies changes don’t apply during serve/watch Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: --serve restart Changes to projects shouldn’t need to restart dev server
Projects
None yet
Development

No branches or pull requests

3 participants