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
fix: make "url" optional in resolver created with createResolve #44
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { resolvePath, createResolve, resolveImports } from 'mlly' | ||
|
||
import.meta.resolve = createResolve({ url: import.meta.url }) | ||
console.log(await import.meta.resolve('./cjs.mjs')) | ||
const resolve = createResolve({ url: import.meta.url }) | ||
console.log(await resolve('./cjs.mjs')) | ||
Comment on lines
+3
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that those test files are not really used for anything right now (which is a shame because it would have caught an issue otherwise) but I've changed this to create a local variable rather than assigning to |
||
|
||
console.log(await resolvePath('./cjs.mjs', { url: import.meta.url })) | ||
console.log(await resolvePath('./foo', { url: import.meta.url })) | ||
|
||
console.log(await resolveImports(`import foo from './eval.mjs'`, { url: import.meta.url })) | ||
console.log(await resolveImports('import foo from \'./eval.mjs\'', { url: import.meta.url })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also noticed that the logic here is incorrect as the defaults will override the
url
even when it is explicitly provided. I didn't want to mix that fix in into this one but I can create a follow-up PR for that.