This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +36
-10
lines changed Expand file tree Collapse file tree 2 files changed +36
-10
lines changed Original file line number Diff line number Diff line change 13
13
"devDependencies" : {
14
14
"html-webpack-plugin" : " ^3.2.0" ,
15
15
"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 " ,
18
18
"webpack-cli" : " ^3.0.8"
19
19
},
20
20
"dependencies" : {
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
3
const path = require ( 'path' )
4
- const UglifyJsPlugin = require ( 'uglifyjs -webpack-plugin' )
4
+ const TerserPlugin = require ( 'terser -webpack-plugin' )
5
5
const HtmlWebpackPlugin = require ( 'html-webpack-plugin' )
6
6
7
7
module . exports = {
@@ -11,18 +11,44 @@ module.exports = {
11
11
'./index.js'
12
12
] ,
13
13
plugins : [
14
- new UglifyJsPlugin ( {
15
- sourceMap : true ,
16
- uglifyOptions : {
17
- mangle : false ,
18
- compress : false
19
- }
20
- } ) ,
21
14
new HtmlWebpackPlugin ( {
22
15
title : 'IPFS MFS example' ,
23
16
template : 'index.html'
24
17
} )
25
18
] ,
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
+ } ,
26
52
output : {
27
53
path : path . join ( __dirname , 'dist' ) ,
28
54
filename : 'bundle.js'
You can’t perform that action at this time.
0 commit comments