-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
import.meta.resolve support #14930
import.meta.resolve support #14930
Conversation
✅ Deploy Preview for jestjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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?
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!
From reading the docs, it seems
I'll fix both 🙂 |
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. |
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 have import.meta.resolve(…) to express a relative path resolution.
It is supported by all major browsers and all major runtimes.
import.meta.resolve
Support: 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.