Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the default export shape in strict ESM environments (#543)
- Loading branch information
Showing
14 changed files
with
1,791 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
"@preconstruct/cli": minor | ||
--- | ||
|
||
Added a new `exports.importConditionDefaultExport` config option. It allows you to generate `import` exports condition (and corresponding files) to fix the export shape incompatibility between node and bundlers. | ||
|
||
With this option set to `"default"` this will always resolve to what has been written as a default export: | ||
|
||
```ts | ||
// lib/src/index.js | ||
export default 42; | ||
export const named = "awesome"; | ||
|
||
// app/consume.mjs | ||
import smth from "lib"; | ||
smth; // 42, and not `{ default: 42, named: 'awesome' }` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.