Commit 98710a5
committed
fix: Improve ESM compatibility for named exports
This commit fixes ESM interoperability issues identified by @arethetypeswrong/cli
where named exports weren't accessible when importing from ESM.
Changes:
- Refactor receiver exports to use import-then-export pattern instead of
`export { default as X }` syntax
- Separate type-only exports using `export type` for better tree-shaking
- Fix Logger and OAuth type re-exports to be type-only
The previous pattern `export { default as ExpressReceiver } from './receivers/ExpressReceiver'`
generated code with `__importDefault().default` which isn't statically analyzable
by Node.js's ESM-CJS interop layer.
The new pattern imports first then re-exports:
```typescript
import ExpressReceiver from './receivers/ExpressReceiver';
export { ExpressReceiver };
export type { ExpressReceiverOptions } from './receivers/ExpressReceiver';
```
This generates simpler CommonJS code that Node.js can properly expose as named
exports when imported from ESM.
Verified with @arethetypeswrong/cli - NamedExports errors are now resolved.
Relates to #2565, #2632, #26441 parent 6b0f985 commit 98710a5
1 file changed
+19
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
27 | 36 | | |
28 | 37 | | |
29 | 38 | | |
| |||
68 | 77 | | |
69 | 78 | | |
70 | 79 | | |
71 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
72 | 85 | | |
73 | 86 | | |
74 | 87 | | |
75 | 88 | | |
76 | | - | |
77 | | - | |
78 | 89 | | |
79 | 90 | | |
80 | 91 | | |
| |||
0 commit comments