Skip to content

Commit 382b961

Browse files
authored
Use the exports object in package.json for node 14 (#8)
This should help us support esm in node and anyone else who follows along. Bonus cleanup the rollup file and sort some ignore files.
1 parent 4aa0ba6 commit 382b961

File tree

5 files changed

+34
-37
lines changed

5 files changed

+34
-37
lines changed

.npmignore

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1+
.github
12
.gitignore
23
.travis.yml
34
.vscode
5+
api-extractor.json
6+
benchmark
7+
budle-types.js
8+
dist-ts
49
lib
510
package-lock.json
11+
package-tests
12+
rollup.config.js
13+
SECURITY.md
614
tsconfig-build.json
715
tsconfig.json
816
tslint.json
9-
benchmark
10-
dist-ts
11-
rollup.config-esm.js
12-
rollup.config-umd.js
13-
budle-types.js
14-
dist/tsdoc-metadata.json
15-
SECURITY.md
16-
api-extractor.json
17-
.github

package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
"name": "streaming-iterables",
33
"version": "5.0.1",
44
"description": "A collection of utilities for async iterables. Designed to replace your streams.",
5-
"main": "dist/index.js",
6-
"module": "dist/index-esm.js",
5+
"main": "./dist/index.js",
6+
"module": "./dist/index.mjs",
7+
"exports": {
8+
"require": "./dist/index.js",
9+
"import": "./dist/index.mjs"
10+
},
711
"types": "dist/index.d.ts",
812
"repository": "[email protected]:reconbot/streaming-iterables.git",
913
"homepage": "https://github.com/reconbot/streaming-iterables",
@@ -13,7 +17,7 @@
1317
"unit-test": "mocha",
1418
"lint": "tsc && tslint lib/*.ts",
1519
"format": "tslint lib/*.ts --fix",
16-
"build": "tsc -p tsconfig-build.json && rollup -c rollup.config-esm.js && rollup -c rollup.config-umd.js && api-extractor run --local --verbose",
20+
"build": "tsc -p tsconfig-build.json && rollup -c && api-extractor run --local --verbose",
1721
"prepare": "npm run build"
1822
},
1923
"keywords": [

rollup.config-esm.js

-12
This file was deleted.

rollup.config-umd.js

-13
This file was deleted.

rollup.config.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import resolve from 'rollup-plugin-node-resolve'
2+
3+
export default {
4+
input: './dist-ts/index.js',
5+
plugins: [
6+
resolve({})
7+
],
8+
output: [
9+
{
10+
format: 'esm',
11+
file: './dist/index.mjs'
12+
},
13+
{
14+
format: 'umd',
15+
name: 'streamingIterables',
16+
file: './dist/index.js'
17+
},
18+
]
19+
}

0 commit comments

Comments
 (0)