-
-
Notifications
You must be signed in to change notification settings - Fork 496
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
Comments
A cache buster does exist for ESM in 11ty, must be a regression here. |
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? |
Shipping with v3.0.0-alpha.14, using module.register to cache bust dependencies when logged as changed by the file watcher. https://nodejs.org/docs/latest/api/module.html#moduleregisterspecifier-parenturl-options |
@zachleat I think the fix for this issue (6b8e53e) broke a workflow: Versions:
I try to use the Chrome DevTools for Node.js to profile my 11ty build with this command:
After connecting the debugger and resuming execution, the build hangs. When I manually pause the debugger, it's stuck here in 11ty code: Line 17 in 7128d07
Deeper into the stack, execution has stopped here: The stack at that point looks like
When I use Eleventy 3.0.0-alpha.13, the problem doesn't manifest and I can debug through the entire build without issue. |
@noelleleigh filed at #3371 |
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! 🙏
The text was updated successfully, but these errors were encountered: