Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.1k
feat(import.meta): add dirname and filename#19990
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
base:main
Are you sure you want to change the base?
feat(import.meta): add dirname and filename#19990
Conversation
alexander-akait left a comment• 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.
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.
It should not work like here, import.meta.dirname and import.meta.filename arenot supported by browsers (and maybe other envs), we should do the same as for__dirname
and__filename
, look atNdeStuffPlugin.js
and we should do the same
Developer can usefs.readFileSync(import.meta.filename)
and after bundling the path will be broken
codspeed-hqbot commentedOct 7, 2025 • 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.
CodSpeed Performance ReportMerging#19990 willnot alter performanceComparing Summary
|
You mean like a variable response depending on the value of |
@avivkeller Yeah, we should duplicate logic, but for such things, and improve Feel free to split these steps into multiple commits/PRs |
Uh oh!
There was an error while loading.Please reload this page.
Summary
Fixes#18320 by adding the requested
import.meta
properties.What kind of change does this PR introduce?
This PR adds support for
import.meta.{dirname,filename}
, having them return the identical data that__dirname
and__filename
return.Did you add tests for your changes?
Yes. I verified that
import.meta.dirname + [filename] === import.meta.filename === an existing file
.Does this PR introduce a breaking change?
No, this is asemver-minor change.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Once merged, the additional properties must be documented accordingly.