Skip to content

Commit c19f743

Browse files
committed
fix: ES5 support
It seems that at least one package (`debug`) doesn't provide code transpiled to ES5 through node_modules. Since it by default imports from src/, a resolve alias is added to point to the dist/debug.js file instead. A new ES5 target is also added at `dist/es5`. closes: #158
1 parent e061389 commit c19f743

File tree

5 files changed

+42
-2
lines changed

5 files changed

+42
-2
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ stream transforms for Node & the Web.
1313
The primary purpose is to deal with RTP streams in a browser without
1414
the need to use plugins or Flash, but relying on the [Media Source Extensions](https://www.w3.org/TR/media-source/) standard, which is supported in all modern browsers.
1515

16+
_Note for IE11 users_: if you want to build the library yourself for IE11 instead
17+
of using the provided bundle, you need import from `dist/es5` with the following fix in webpack:
18+
19+
```
20+
alias: {
21+
debug: 'debug/dist/debug.js',
22+
},
23+
```
24+
25+
You can look at the `webpack.config.js` to see how it's used for building the bundle.
26+
1627
## Structure
1728

1829
The library contains a collection of components that can be connected

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
"lint": "tslint --project tsconfig.json --format stylish",
1515
"test": "jest --coverage",
1616
"verify": "yarn lint && yarn test",
17-
"build": "yarn build:esm && yarn build:cjs && yarn build:bundle",
17+
"build": "yarn build:esm && yarn build:cjs && yarn build:es5 && yarn build:bundle",
1818
"build:esm": "tsc -p tsconfig.json",
1919
"build:cjs": "tsc -p tsconfig.cjs.json",
20+
"build:es5": "tsc -p tsconfig.es5.json",
2021
"build:bundle": "webpack",
2122
"rtsp": "rtsp-ws-server/start.sh",
2223
"dev": "webpack --mode development --watch",

tsconfig.es5.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"compilerOptions": {
3+
/* Include Typescript declaration files */
4+
"declaration": true,
5+
6+
/* Basic Options */
7+
"target": "es5",
8+
"downlevelIteration": true,
9+
"module": "es2015",
10+
"outDir": "./dist/es5",
11+
"skipLibCheck": true,
12+
"sourceMap": true,
13+
14+
/* Strict Type-Checking Options */
15+
"strict": true,
16+
17+
/* Module Resolution Options */
18+
"moduleResolution": "node",
19+
"esModuleInterop": true
20+
},
21+
"include": ["lib/**/*"]
22+
}

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
/* Include Typescript declaration files */
44
"declaration": true,
5-
5+
66
/* Basic Options */
77
"target": "es2015",
88
"module": "es2015",

webpack.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ module.exports = {
99
},
1010
resolve: {
1111
extensions: ['.ts', '.js'],
12+
// The debug packages resolves to src/debug.js by default
13+
// which doesn't work on IE11 (it's not ES5), but it seems
14+
// that the dist/debug.js file does work.
15+
alias: {
16+
debug: 'debug/dist/debug.js',
17+
},
1218
},
1319
module: {
1420
rules: [

0 commit comments

Comments
 (0)