diff --git a/examples/browser-readablestream/package.json b/examples/browser-readablestream/package.json index 55307c63e9..32d0c06672 100644 --- a/examples/browser-readablestream/package.json +++ b/examples/browser-readablestream/package.json @@ -11,10 +11,10 @@ "author": "", "license": "ISC", "devDependencies": { - "html-webpack-plugin": "^2.30.1", + "html-webpack-plugin": "^3.2.0", "http-server": "~0.11.1", - "uglifyjs-webpack-plugin": "^1.2.0", - "webpack": "^3.11.0" + "terser-webpack-plugin": "^1.2.1", + "webpack": "^4.28.4" }, "dependencies": { "videostream": "^2.4.2" diff --git a/examples/browser-readablestream/webpack.config.js b/examples/browser-readablestream/webpack.config.js index 29d6edfb64..a20cb0a67c 100644 --- a/examples/browser-readablestream/webpack.config.js +++ b/examples/browser-readablestream/webpack.config.js @@ -1,7 +1,7 @@ 'use strict' const path = require('path') -const UglifyJsPlugin = require('uglifyjs-webpack-plugin') +const TerserPlugin = require('terser-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin') module.exports = { @@ -10,18 +10,44 @@ module.exports = { './index.js' ], plugins: [ - new UglifyJsPlugin({ - sourceMap: true, - uglifyOptions: { - mangle: false, - compress: false - } - }), new HtmlWebpackPlugin({ title: 'IPFS Videostream example', template: 'index.html' }) ], + optimization: { + minimizer: [ + new TerserPlugin({ + terserOptions: { + parse: { + // we want terser to parse ecma 8 code. However, we don't want it + // to apply any minfication steps that turns valid ecma 5 code + // into invalid ecma 5 code. This is why the 'compress' and 'output' + // sections only apply transformations that are ecma 5 safe + // https://github.com/facebook/create-react-app/pull/4234 + ecma: 8 + }, + compress: { + ecma: 5, + warnings: false + }, + mangle: { + safari10: true + }, + output: { + ecma: 5, + comments: false + } + }, + // Use multi-process parallel running to improve the build speed + // Default number of concurrent runs: os.cpus().length - 1 + parallel: true, + // Enable file caching + cache: true, + sourceMap: true + }) + ] + }, output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js'