Commit deca13e
committed
fix(mrt): add exports map with ESM-flavoured type declarations
`moduleResolution: node16`/`nodenext` consumers currently read
`dist/index.d.ts` in a CommonJS context, so named imports/types resolve
incorrectly.
Add an `exports` map that routes types per condition: `import` → a new
`dist/index.d.mts` (read as ESM), `require` → the existing
`dist/index.d.ts`. Runtime resolution is unchanged — both `import` and
`require` `default` point at the existing CJS build (`dist/index.js`),
and a `"module"` condition points at the ESM build so bundlers keep the
tree-shakeable output (matching the existing `module` field; Node
ignores this condition). The `.d.mts` is a second output of the existing
`rollup-plugin-dts` step — no copy step, no new dependency. `"./*"`
preserves deep imports (e.g. `locales`).1 parent 6008059 commit deca13e
2 files changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
30 | 44 | | |
31 | 45 | | |
32 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
0 commit comments