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

hot reloading of 11ty ESM config dependencies (v3) #3270

Open
jens-struct opened this issue May 1, 2024 · 2 comments
Open

hot reloading of 11ty ESM config dependencies (v3) #3270

jens-struct opened this issue May 1, 2024 · 2 comments
Labels
bug: --serve restart Changes to projects shouldn’t need to restart dev server bug release: canary A release on the canary channel

Comments

@jens-struct
Copy link

jens-struct commented May 1, 2024

Is your feature request related to a problem? Please describe.

Imports inside the ESM 11ty config file are not reevaluated in 11ty version 3, i mean there is no hot reloading of these dependencies while being in watch mode.

Describe the solution you'd like

Hot reloading of ESM 11ty config dependencies works while being in watch mode.

Describe alternatives you've considered

No response

Additional context

The (old) related issue for CommonJS modules: #1052

For ESM it is probably not possible because "The esm cache is not exposed, and even if it were, it is not mutable." (More info here: nodejs/help#2806)

In my usecase i used a cachebuster, like described here: https://ar.al/2021/02/22/cache-busting-in-node.js-dynamic-esm-imports/#cache-invalidation-in-esm-with-dynamic-imports (please note: this causes a memory leak)

So, as far as i understand, adding hot relaoding for ESM is not possible in a standard way for now? Or did i miss something here?

(Otherwise 11ty v3 works really well, great work!)

Thanks! 🙏

@zachleat
Copy link
Member

zachleat commented May 1, 2024

A cache buster does exist for ESM in 11ty, must be a regression here.

@zachleat zachleat added the release: canary A release on the canary channel label May 1, 2024
@jens-struct
Copy link
Author

FYI: I experienced it for importing nunjucks filter, shortcodes, ... from external files. A reload does happen, when the file is changed, but the updated content isn't included.

And as far as i understand, you have to add a cachebuster for your own imports. Or is there some 11ty magic, where 11ty adds these to all ESM imports?

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 bug release: canary A release on the canary channel
Projects
None yet
Development

No branches or pull requests

2 participants