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

Feature Request: Support file urls #430

Open
latin-1 opened this issue Jul 20, 2024 · 3 comments
Open

Feature Request: Support file urls #430

latin-1 opened this issue Jul 20, 2024 · 3 comments

Comments

@latin-1
Copy link

latin-1 commented Jul 20, 2024

const resolve = require("enhanced-resolve");
resolve.sync("file:///path/to/project", "module");
resolve.sync("file:///path/to/project", "file:///path/to/module");
@alexander-akait
Copy link
Member

Why you need it here? Currently we work only with paths, schemas support implemented in webpack

@latin-1
Copy link
Author

latin-1 commented Jul 23, 2024

I think this would better align with Node.js behavior. AFAICT import in Node.js accepts file URLs.

const url = import.meta.resolve("./some-module.mjs");
// "file:///path/to/some-module.mjs"
await import(url);

@alexander-akait
Copy link
Member

alexander-akait commented Jul 23, 2024

Feel free to send a PR https://github.com/webpack/enhanced-resolve/blob/main/lib/Resolver.js#L729, just check it is a scheme URL and remove it before parseIdentifier

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