Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork6.6k
import.meta.resolve support#14930
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
netlifybot commentedFeb 29, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview forjestjs ready!
To edit notification comments on pull requests, go to yourNetlify site configuration. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
SimenB left a comment
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.
Thanks! could you also add a changelog entry?
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
CheadleCheadle left a comment
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.
looks good to me!
SimenB commentedMar 3, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
From reading the docs, it seems
I'll fix both 🙂 |
SimenB left a comment
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.
thanks!
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Uh oh!
There was an error while loading.Please reload this page.
Summary
Fixes#14923
Jest and libraries support using
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);to resolve relative paths.This was a useful convention for a while, but now we haveimport.meta.resolve(…) to express a relative path resolution.
It is supported byall major browsers and all major runtimes.
import.meta.resolveSupport: Jest now supports the import.meta.resolve function, allowing users to resolve module specifiers in a manner consistent with the standard JavaScript module system.Test plan
Successfully resolves paths
Note: This is an initial, primitive implementation and currently supports basic resolution functionality. I am interested in what features such as support for dynamic string values should be incorporated.