Skip to content

Commit 7b4ccff

Browse files
committed
Add process and stream-browserify to enable the yospace sdk to work in browsers with Webpack 5+
1 parent 3586875 commit 7b4ccff

File tree

3 files changed

+52
-17
lines changed

3 files changed

+52
-17
lines changed

package-lock.json

+39-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
"node": "16.15.1"
3030
},
3131
"dependencies": {
32-
"fast-safe-stringify": "^2.0.7"
32+
"fast-safe-stringify": "^2.0.7",
33+
"process": "^0.11.10",
34+
"stream-browserify": "^3.0.0"
3335
},
3436
"peerDependencies": {
3537
"@yospace/admanagement-sdk": "^3.4.0"

webpack.common.js

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path');
2+
const webpack = require('webpack');
23

34
module.exports = {
45
entry: './src/ts/main.ts',
@@ -13,6 +14,10 @@ module.exports = {
1314
},
1415
resolve: {
1516
extensions: ['.tsx', '.ts', '.js'],
17+
fallback: {
18+
stream: require.resolve('stream-browserify'), // and install `stream-browserify`
19+
buffer: false, // require.resolve("buffer/") and install `buffer`
20+
},
1621
},
1722
output: {
1823
filename: './bitmovin-player-yospace.js',
@@ -25,4 +30,9 @@ module.exports = {
2530
},
2631
},
2732
target: ['web', 'es5'],
33+
plugins: [
34+
new webpack.ProvidePlugin({
35+
process: 'process/browser',
36+
}),
37+
],
2838
};

0 commit comments

Comments
 (0)