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

RFC: [node-resolve] Use native node resolution instead of own implementation #1097

Closed
daKmoR opened this issue Jan 27, 2022 · 4 comments
Closed

Comments

@daKmoR
Copy link

daKmoR commented Jan 27, 2022

  • Rollup Plugin Name: @rollup/plugin-node-resolve
  • Rollup Plugin Version: 13.1.3

Feature Use Case

  • The goal would be that plugin-node-resolve resolves exactly the same way node resolves natively.
  • It could remove a lot of code complexity.
  • It would ensure improvements/changes in node will always be available in the plugin.

It would therefore solve issues like #1077

Feature Proposal

Replace the custom node resolution with something like this (simplified)

import { createRequire } from 'module';

const require = createRequire('/path/to/source-file-it-resolves-from.js');
const resolvedPath = require.resolve('foo-pkg/bar');

This will probably mean some custom options will no longer work there it will probably need to be a breaking change.

Overall my question is if it even makes sense to look into something like this or if it's a no-go?

@shellscape
Copy link
Collaborator

This has been discussed at length in the past by @guybedford and others. Please give the issues a search.

@daKmoR
Copy link
Author

daKmoR commented Jan 27, 2022

I tried to search... what I tried...

  • createRequire => nothing
  • node resolve native => only unrelated "Proposal: Add support for full ES-Node interop"
  • require.resolve => nothing related
  • use require resolve => nothing related
  • ... => what shall I search for or can you share a link?

@shellscape
Copy link
Collaborator

There's relevant discussion in:

And a slew of offshoot issues and PRs.

TL:DR - It's been thoroughly discussed and is extremely unlikely to happen.

@stale stale bot added the x⁷ ⋅ stale label Mar 29, 2022
@stale
Copy link

stale bot commented Mar 30, 2022

Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it.

@stale stale bot closed this as completed Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants