egoist / egoist/tsup

Inject cjs and esm shims support `import.meta.dirname`

Open
#1,298 0 comments 6 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
274
PR merge metrics
No merged PRs in 30d

Description

https://nodejs.org/docs/latest/api/esm.html#importmetadirname

`import.meta.filename` is the same as the `url.fileURLToPath()` of the `import.meta.url`.
`import.meta.dirname` is the same as the `path.dirname()` of the `import.meta.filename`.

[inject-cjs-and-esm-shims](https://tsup.egoist.dev/#inject-cjs-and-esm-shims) need support `import.meta.dirname` and `import.meta.filename`

Contributor guide

Open the contributing guide

Research direction

Read the linked Node.js ESM documentation and the tsup “inject-cjs-and-esm-shims” documentation first. Trace the implementation of those shims, then verify that both import.meta.dirname and import.meta.filename are supported consistently for CommonJS and ESM output.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
build-system, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.