-
Notifications
You must be signed in to change notification settings - Fork 17
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
--experimental-loader breaks in Node 18.19 #184
Comments
It’s probably one of these: https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V18.md#esm-and-customization-hook-changes These changes landed more than a year ago on the newer release lines, so reverting them isn’t possible without breaking everyone using v20 and later. The API has changed significantly since you last used it; the recommended approach now is to use |
Thanks for the quick reply!
Yeah I had already read through that, but it wasn't very useful wrt solving my use case.
Gotcha, I'll check it out. We use Aws Lambda and the lts versions only just updated to that version and started breaking our test. The 20.x must still be on an older minor version, there this still works. Are there any complete examples anywhere how one would do import hot reloading like the above loader does? |
Looks like this thread is a never ending saga lol I'll try my luck there again... See what people have been cooking up recently. Man I miss cjs... |
That thread is about avoiding gradual memory leaks when hot reloading (since there’s no way to garbage-collect the replaced module). Simply implementing hot reloading itself is a solved problem: Vite has been doing it for years. See https://dev.to/giltayar/mock-all-you-want-supporting-es-modules-in-the-testdouble-js-mocking-library-3gh1 for instructions on implementing it yourself, and links to lower-level libraries that implement just that part. I’m going to close this since there’s no clear request or bug presented, but if you find one I’m happy to reopen. Edit: The above article was written in 2020 and so refers to an older version of the API. A more updated variation can be found at https://github.com/testdouble/testdouble.js/blob/main/docs/7-replacing-dependencies.md#how-module-replacement-works-for-es-modules-using-import, with code that works in current Node. |
Thanks for pointing me in the right direction. Ended up being a somewhat simple fix. Much appreciated! |
Hello ya'll. You broke something and I'm back again =)
I have the following
--experimental-loader
that worked great pre node v18.19.0.However as of that version it breaks. Since I have no idea what changed and the (changelog) documentation is somewhat sparse, I would much appreciate if someone could help with what to investigate and how to fix it.
This loader is used in a test framework that is used by hundreds of repositories. So it breaking is rather inconvenient.
Expand
Appreciate all your hard work and really looking forward to loaders being stable ;-)
Cheer, L~
The text was updated successfully, but these errors were encountered: