ITADN

feat: add support for import.meta.dirname and import.meta.filename

#782Pull Requesthnshah 创建于 2026-03-24
H
hnshahcommented
## Fixes #781 Adds support for Node.js 20.11+ `import.meta.dirname` and `import.meta.filename` properties. ### Problem - .js files transformed to CJS had `undefined` for these properties - Caused TypeError crashes when code tried to use them - .ts and .mjs files already worked (different code path) ### Solution Follow same pattern as `import.meta.url` using esbuild `define`. ### Testing ```bash # Before: tsx test.js → undefined, undefined # After: tsx test.js → /path/to/dir, /path/to/dir/test.js ``` Reference: https://github.com/unjs/jiti/pull/308
合并状态:未合并 2 条评论