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

Ambiguous Package Name #62

Open
georg-schwarz opened this issue May 8, 2024 · 1 comment
Open

Ambiguous Package Name #62

georg-schwarz opened this issue May 8, 2024 · 1 comment

Comments

@georg-schwarz
Copy link

We stumbled upon the issue of ambiguous imports when using this library.
require(assert) can refer to the library or Node's assert API.

It would be awesome to have the library available under a second name (e.g., assert.js) in use cases where you don't want to have this ambiguity. Other libraries with the same issue went down a similar road, e.g. punycode.

Original thread: sindresorhus/eslint-plugin-unicorn#2326

@georg-schwarz georg-schwarz changed the title Ambiguous Library Name Ambiguous Package Name May 8, 2024
@ljharb
Copy link
Member

ljharb commented May 8, 2024

in node, require of “assert” will always only be the core module. There’s no ambiguity.

If you want to refer to this package, you require “assert/“. For native ESM, there’s not a good solution there, as indicated in the linked issue.

In browsers when using a bundler, this package is transparently used instead of the node core module, which is the point.

When would you want to use this package directly such that you need to disambiguate?

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

No branches or pull requests

2 participants