Skip to content

Commit aefe557

Browse files
authored
packaging thats backwards compatible
1 parent d243f3e commit aefe557

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

PACKAGING_FOR_THE_BROWSER.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,43 @@
2424
}
2525
```
2626

27+
28+
> source: [https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/)
29+
30+
```json
31+
// package.json
32+
{
33+
"name": "my-package",
34+
"type": "module",
35+
"exports": {
36+
".": {
37+
// Entry-point for `import "my-package"` in ESM
38+
"import": "./esm/index.js",
39+
40+
// Entry-point for `require("my-package") in CJS
41+
"require": "./commonjs/index.cjs",
42+
43+
// Entry-point for TypeScript resolution
44+
"types": "./types/index.d.ts"
45+
},
46+
},
47+
48+
// CJS fall-back for older versions of Node.js
49+
"main": "./commonjs/index.cjs",
50+
51+
// Fall-back for older versions of TypeScript
52+
"types": "./types/index.d.ts"
53+
}
54+
```
55+
56+
```json
57+
{
58+
"dependencies": {
59+
"@typescript/lib-dom": "npm:@types/web"
60+
}
61+
}
62+
```
63+
2764
## types
2865

2966

0 commit comments

Comments
 (0)