Skip to content

Conversation

@timfish
Copy link
Contributor

@timfish timfish commented Jan 30, 2025

This PR removes resolve as a dependency and instead uses require.resolve. This changes our minimum supported Node version from v8.0.0 to v8.10.0 which is a breaking change.

Before this change our dependencies looked like this:
image

@timfish
Copy link
Contributor Author

timfish commented Feb 3, 2025

Will this break Node Single Executable Apps?

@trentm
Copy link
Contributor

trentm commented Feb 4, 2025

Will this break Node Single Executable Apps?

I was going to (perhaps naively) suggest that RITM in a SEA app should no-op for non-core modules.

https://nodejs.org/api/single-executable-applications.html#requireid-in-the-injected-main-script-is-not-file-based suggests that a file-based require can be obtained, however. So I guess we'll need to feel this out and add tests.

I suppose that could be considered separate work and not necessarily a breaking change? Supporting SEA apps at all was accidental.

@timfish
Copy link
Contributor Author

timfish commented Feb 4, 2025

Yeah it looks like SEA apps were working out of luck before and we broke them with my change for 7.5.0.

So we should merge #106 and then get some tests in place before merging this PR!

@BYK
Copy link
Contributor

BYK commented Feb 4, 2025

Not sure if I understand the implications fully here but the SEA application I'm working on uses Sentry Node SDK to instrument itself (not just errors) which then relies on this package. If that stops working, that would be quite disappointing as I think we should be able to instrument SEA apps?

@timfish
Copy link
Contributor Author

timfish commented Feb 4, 2025

If that stops working, that would be quite disappointing as I think we should be able to instrument SEA apps?

We intend to add SEA tests before merging this PR to ensure we retain compatibility.

@anotheri
Copy link

anotheri commented Jun 6, 2025

any luck we'll see this released soon?

@timfish
Copy link
Contributor Author

timfish commented Jun 17, 2025

It is still planned but it's been bumped down my priorities by other things because nothing is broken.

PRs to add the extra required test coverage are welcome though!

@timfish timfish marked this pull request as ready for review September 24, 2025 12:20
@timfish
Copy link
Contributor Author

timfish commented Sep 24, 2025

I looked at adding CI tests for Node SEA applications but couldn't get it working on macOS because the executable needs signing before it'll work.

Because this PR will result in a new major version, I still think this is safe to release without a specific SEA CI test.

@timfish timfish changed the title feat!: Remove resolve dependency which increases min Node version to v8.10.0 feat!: Remove dependency on resolve module Sep 24, 2025
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine without the test, but

I looked at adding CI tests for Node SEA applications but couldn't get it working on macOS because the executable needs signing before it'll work.

There is github.com/byk/fossilize (https://byk.im/posts/fossilize/), but we'll still need to join the apple developer program to do this, and managing the secrets/paying the fee is quite a lot for this :(

Copy link
Member

@watson watson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The engines.node field in package.json should be updated accordingly

@timfish
Copy link
Contributor Author

timfish commented Sep 24, 2025

There is github.com/byk/fossilize

I used this to build the test app!

A Windows or Linux test might be fine but then a large proportion of us won't be able to run it.

@timfish timfish requested a review from watson September 24, 2025 12:55
@BYK
Copy link
Contributor

BYK commented Sep 24, 2025

There's a way to use a self-signed cert and allow-list it for CI and dev mode. Happy to explore and help there if there's interest

package.json Outdated
"homepage": "https://github.com/nodejs/require-in-the-middle#readme",
"engines": {
"node": ">=8.6.0"
"node": ">=8.10.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nit: I can't remember if Node.js 9 is technically supported by this lib (it's no longer tested), but to be consistent with the new error thrown in this PR, shouldn't it be like this?

Suggested change
"node": ">=8.10.0"
"node": ">=9.3.0 || >=8.10.0 <9.0.0"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep good call!

Co-authored-by: Thomas Watson <w@tson.dk>
@timfish timfish merged commit 67076ff into nodejs:main Sep 24, 2025
13 checks passed
@timfish timfish deleted the timfish/feat/remove-resolve branch September 24, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants