-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
[v10.x] Backport createRequire to v10 #34950
Conversation
This is an abstraction on top of creatRequireFromPath that can accept both paths, URL Strings, and URL Objects. PR-URL: nodejs#27405 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: nodejs#27629 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]>
Update the example to use import and import.meta.url instead of require() and require.resolve(). PR-URL: nodejs#27762 Fixes: nodejs#27758 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anto Aravinth <[email protected]>
Review requested:
|
Does this really work? The ES modules implementation in < 12 was significantly different than what shipped in 12. |
I don't think we should ship new features on 10.x |
I does work, at least the tests pass.
No hard feeling if this gets rejected, I don't think that feature gets used a lot on v10 anyway (because ESM implementation is still behind a flag). |
I think That being said, I kind of agree with @mcollina: It feels late to add new features to v10. It's been out of active LTS for a bit and has less than a year left before it goes out of support. This isn't a critical bug fix, so it likely shouldn't go into v10. |
If this are the rules, maybe we could add in our process to delete labels such as
The original PR for this backport meets both criteria, I think our guides and label system shouldn’t encourage to create invalid PRs. node/doc/guides/backporting-to-release-lines.md Lines 11 to 25 in 496c174
|
@aduh95 That sounds reasonable (cc @nodejs/lts). Pull request along those lines welcome. If you haven't seen it, https://github.com/nodejs/Release#release-phases describes the release phases and the general guidelines as to what goes in. We've tried to keep general policy in the Release WG repository and mechanics (i.e. the how-tos) as guides in this repository. |
This PR adds the
createRequire
API to Node.js v10 – which currently only has the deprecatedcreateRequireFromPath
available.Note that this does not backport the deprecation of
createRequireFromPath
, given the fact that v10 is on maintenance mode, I figured that would not make sense to introduce a deprecation at this point.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes