Skip to content

Commit 7d73030

Browse files
committed
Fix typo
1 parent fb3fc3e commit 7d73030

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/posts/2024-04-28_Default_Exports_in_CommonJS_Libraries.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ exports.default = "Hello, world";
131131

132132
// main.mjs
133133
import hello from "hello";
134-
console.log(greetings); // { default: "Hello, world" }
135-
console.log(greetings.default); // "Hello, world"
134+
console.log(hello); // { default: "Hello, world" }
135+
console.log(hello.default); // "Hello, world"
136136
```
137137

138138
Our _real_ default import fails to bind to our _transformed_ default export—we still need to access the `.default` property! This can make it nearly impossible to write code that works both in Node.js and in all bundlers. So, while the behavior with transformed `export default` in `tsc` is understandable and predictable, it is indeed problematic for libraries.

0 commit comments

Comments
 (0)