Skip to content

Commit

Permalink
fix: add higher optimizations to Terser
Browse files Browse the repository at this point in the history
By applying more optimizations the code size is reduced.

Reuces the size from
145.44 KB  + 61 KB
to
134.76 KB  +   57.42 KB
  • Loading branch information
aminya committed Dec 29, 2020
1 parent 73d9ec4 commit b3d00af
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .terserrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const isDev = process.env.NODE_ENV !== "production"

module.exports = {
// "module": false, // controlled by Parcel
"compress": {
"ecma": "2018", // Change based on the target
// "toplevel": true, // controlled by Parcel
"hoist_vars": true,
"hoist_funs": true,
"pure_getters": true,
"unsafe": true,
"unsafe_arrows": true,
"unsafe_comps": true,
"unsafe_Function": true,
"unsafe_math": true,
"unsafe_symbols": true,
"unsafe_methods": true,
"unsafe_proto": true,
"unsafe_regexp": true,
"unsafe_undefined": true,
"passes": isDev ? 0 : 2,
},
"parse": {
"ecma": 2020
},
"mangle": !isDev,
"format": {
"beautify": isDev
},
}

0 comments on commit b3d00af

Please sign in to comment.