Skip to content

Commit f0a62f4

Browse files
authored
Update 02_standard_package_output_folders.md
1 parent 38b7c81 commit f0a62f4

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

rfcs/build-system/02_standard_package_output_folders.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ Today, `lib` contains esm JavaScript output, except for node-only packages which
2020

2121
We've historically used the following standard output folders in a published JavaScript package (only applicable output folders would be present):
2222

23-
- `lib` - esm (as we've had for a long time)
24-
- `lib-commonjs` - commonjs (only needed while Node <= 13.2.0 is supported)
25-
- `lib-amd` - amd (hopefully we can drop someday)
26-
- `dist` - bundles and static content
23+
- `/lib` - esm (as we've had for a long time)
24+
- `/lib-commonjs` - commonjs (only needed while Node <= 13.2.0 is supported)
25+
- `/lib-amd` - amd (hopefully we can drop someday)
26+
- `/dist` - bundles and static content
2727

28-
If this seems reasonable to folks, we should just stick with this and stay consistent. If a library needs to output CommonJS, it should go inthe `lib-commonjs` folder.
28+
If this seems reasonable, we should adopt and stay consistent to stay predictable to consumers. If a library needs to output CommonJS, it should be output within the `lib-commonjs` folder.
2929

3030
A library like `react-button` which might be consumed by Node and bundlers likely will need both ESM and CommonJS, until Node 13.2.0 or greater is the minimum requirement. Its output will have both a `lib` and `lib-commonjs` folder.
3131

@@ -52,12 +52,10 @@ Once 13.2.0 becomes the minimum Node requirement, there is little reason to buil
5252

5353
Many libraries in OSS have kept `lib` representing CommonJS and have added `es` to the mix as the folder for containing esm. This is very likely because they've existed for a while and didn't want to change their existing folder structure. We could also consider this convention. React itself avoids `lib` and explicitly uses `cjs` to indicate the output format. (It also has no ESM flavor.)
5454

55-
#### Alternative proposal:
56-
57-
* `cjs` - CommonJS
58-
* `es` - esm
59-
* `amd` - amd
60-
* `dist` - statics and bundles
55+
* `/cjs` - CommonJS
56+
* `/es` - esm
57+
* `/amd` - amd
58+
* `/dist` - statics and bundles
6159

6260
#### Pros:
6361

@@ -85,3 +83,4 @@ Many libraries in OSS have kept `lib` representing CommonJS and have added `es`
8583
## Discarded Solutions
8684

8785
The current solution of using `lib` for either CommonJS or ESM depending on which platforms are (currently) supported should be replaced with something that doesn't mean different things in different contexts.
86+

0 commit comments

Comments
 (0)