Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 473346a

Browse files
author
Alan Shaw
authored
docs: fix bundle for browser-readablestream (#1821)
License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 2e2c094 commit 473346a

File tree

2 files changed

+37
-11
lines changed

2 files changed

+37
-11
lines changed

examples/browser-readablestream/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"author": "",
1212
"license": "ISC",
1313
"devDependencies": {
14-
"html-webpack-plugin": "^2.30.1",
14+
"html-webpack-plugin": "^3.2.0",
1515
"http-server": "~0.11.1",
16-
"uglifyjs-webpack-plugin": "^1.2.0",
17-
"webpack": "^3.11.0"
16+
"terser-webpack-plugin": "^1.2.1",
17+
"webpack": "^4.28.4"
1818
},
1919
"dependencies": {
2020
"videostream": "^2.4.2"

examples/browser-readablestream/webpack.config.js

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
const path = require('path')
4-
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
4+
const TerserPlugin = require('terser-webpack-plugin')
55
const HtmlWebpackPlugin = require('html-webpack-plugin')
66

77
module.exports = {
@@ -10,18 +10,44 @@ module.exports = {
1010
'./index.js'
1111
],
1212
plugins: [
13-
new UglifyJsPlugin({
14-
sourceMap: true,
15-
uglifyOptions: {
16-
mangle: false,
17-
compress: false
18-
}
19-
}),
2013
new HtmlWebpackPlugin({
2114
title: 'IPFS Videostream example',
2215
template: 'index.html'
2316
})
2417
],
18+
optimization: {
19+
minimizer: [
20+
new TerserPlugin({
21+
terserOptions: {
22+
parse: {
23+
// we want terser to parse ecma 8 code. However, we don't want it
24+
// to apply any minfication steps that turns valid ecma 5 code
25+
// into invalid ecma 5 code. This is why the 'compress' and 'output'
26+
// sections only apply transformations that are ecma 5 safe
27+
// https://github.com/facebook/create-react-app/pull/4234
28+
ecma: 8
29+
},
30+
compress: {
31+
ecma: 5,
32+
warnings: false
33+
},
34+
mangle: {
35+
safari10: true
36+
},
37+
output: {
38+
ecma: 5,
39+
comments: false
40+
}
41+
},
42+
// Use multi-process parallel running to improve the build speed
43+
// Default number of concurrent runs: os.cpus().length - 1
44+
parallel: true,
45+
// Enable file caching
46+
cache: true,
47+
sourceMap: true
48+
})
49+
]
50+
},
2551
output: {
2652
path: path.join(__dirname, 'dist'),
2753
filename: 'bundle.js'

0 commit comments

Comments
 (0)