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

Commit e7d6d3a

Browse files
dirkmcAlan Shaw
authored andcommitted
fix: browser-mfs example (#2089)
1 parent aaddbbd commit e7d6d3a

File tree

2 files changed

+36
-10
lines changed

2 files changed

+36
-10
lines changed

examples/browser-mfs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"devDependencies": {
1414
"html-webpack-plugin": "^3.2.0",
1515
"http-server": "~0.11.1",
16-
"uglifyjs-webpack-plugin": "^2.1.2",
17-
"webpack": "^4.15.1",
16+
"terser-webpack-plugin": "^1.2.1",
17+
"webpack": "^4.28.4",
1818
"webpack-cli": "^3.0.8"
1919
},
2020
"dependencies": {

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

0 commit comments

Comments
 (0)