Skip to content

Commit 9e4df79

Browse files
committed
Build .cjs bundles from ES5+modules code, for back compat.
1 parent a138a2f commit 9e4df79

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
.reify-cache
77
tsconfig.json
88
tsconfig.rollup.json
9+
tsconfig.es5.json
910
rollup.config.js

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"url": "https://github.com/benjamn/optimism/issues"
2929
},
3030
"scripts": {
31-
"build": "npm run clean && tsc && rollup -c",
31+
"build": "npm run clean && npm run tsc:es5 && tsc && rollup -c && rimraf lib/es5",
32+
"tsc:es5": "tsc -p tsconfig.es5.json",
3233
"clean": "rimraf lib",
3334
"prepare": "npm run build",
3435
"mocha": "mocha --require source-map-support/register --reporter spec --full-trace",

rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function build(input, output, format) {
2626

2727
export default [
2828
build(
29-
"lib/index.js",
29+
"lib/es5/index.js",
3030
"lib/bundle.cjs",
3131
"cjs"
3232
),
@@ -36,7 +36,7 @@ export default [
3636
"esm"
3737
),
3838
build(
39-
"lib/tests/main.js",
39+
"lib/es5/tests/main.js",
4040
"lib/tests/bundle.cjs",
4141
"cjs"
4242
),

tsconfig.es5.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"target": "es5",
5+
"module": "es2015",
6+
"outDir": "lib/es5"
7+
}
8+
}

0 commit comments

Comments
 (0)