Skip to content

Commit afa74ca

Browse files
authored
[docs] Fix incorrect package exports recommendation (#903)
Fixes #902.
1 parent c04bd48 commit afa74ca

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,19 @@
3838

3939
```jsonc
4040
{
41-
"name": "foo", // your package name
41+
"name": "foo", // your package name
4242
"type": "module",
43-
"source": "src/foo.js", // your source code
44-
"exports": "./dist/foo.modern.js", // where to generate the modern bundle (see below)
45-
"main": "./dist/foo.cjs", // where to generate the CommonJS bundle
46-
"module": "./dist/foo.module.js", // where to generate the ESM bundle
47-
"unpkg": "./dist/foo.umd.js", // where to generate the UMD bundle (also aliased as "umd:main")
43+
"source": "src/foo.js", // your source code
44+
"exports": {
45+
"require": "./dist/foo.cjs", // used for require() in Node 12+
46+
"default": "./dist/foo.modern.js" // where to generate the modern bundle (see below)
47+
},
48+
"main": "./dist/foo.cjs", // where to generate the CommonJS bundle
49+
"module": "./dist/foo.module.js", // where to generate the ESM bundle
50+
"unpkg": "./dist/foo.umd.js", // where to generate the UMD bundle (also aliased as "umd:main")
4851
"scripts": {
49-
"build": "microbundle", // compiles "source" to "main"/"module"/"unpkg"
50-
"dev": "microbundle watch" // re-build when source files change
52+
"build": "microbundle", // compiles "source" to "main"/"module"/"unpkg"
53+
"dev": "microbundle watch" // re-build when source files change
5154
}
5255
}
5356
```

0 commit comments

Comments
 (0)