replace uglify with terser

This commit is contained in:
Philipp Kühn 2019-04-30 18:32:12 +02:00
parent 5e6d60c3fe
commit 7128dd7bf3
3 changed files with 4 additions and 20 deletions

View File

@ -1,7 +1,7 @@
import fs from 'fs' import fs from 'fs'
import path from 'path' import path from 'path'
import zlib from 'zlib' import zlib from 'zlib'
import uglify from 'uglify-js' import Terser from 'terser'
import { rollup } from 'rollup' import { rollup } from 'rollup'
import config from './config' import config from './config'
@ -43,9 +43,8 @@ function buildEntry({ input, output }) {
return rollup(input) return rollup(input)
.then(bundle => bundle.generate(output)) .then(bundle => bundle.generate(output))
.then(response => { .then(response => {
// console.log({ bla })
if (isProd) { if (isProd) {
const minified = uglify.minify(response.output[0].code, { const minified = Terser.minify(response.output[0].code, {
output: { output: {
preamble: output.banner, preamble: output.banner,
ascii_only: true, ascii_only: true,
@ -53,8 +52,6 @@ function buildEntry({ input, output }) {
}).code }).code
return write(output.file, minified, true) return write(output.file, minified, true)
} }
// console.log({ isProd })
// console.dir(response, { depth: null })
return write(output.file, response.output[0].code) return write(output.file, response.output[0].code)
}) })
} }

View File

@ -75,8 +75,8 @@
"rollup-plugin-vue": "^5.0.0", "rollup-plugin-vue": "^5.0.0",
"sass-loader": "^7.0.3", "sass-loader": "^7.0.3",
"style-loader": "^0.23.1", "style-loader": "^0.23.1",
"terser": "^3.17.0",
"tippy.js": "^4.3.0", "tippy.js": "^4.3.0",
"uglify-js": "^3.5.9",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-loader": "^15.7.0", "vue-loader": "^15.7.0",
"vue-router": "^3.0.6", "vue-router": "^3.0.6",

View File

@ -3436,11 +3436,6 @@ commander@^2.19.0, commander@^2.2.0, commander@^2.8.1, commander@~2.19.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
commander@~2.20.0:
version "2.20.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==
commondir@^1.0.1: commondir@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
@ -11711,7 +11706,7 @@ terser-webpack-plugin@^1.1.0:
webpack-sources "^1.1.0" webpack-sources "^1.1.0"
worker-farm "^1.5.2" worker-farm "^1.5.2"
terser@^3.16.1: terser@^3.16.1, terser@^3.17.0:
version "3.17.0" version "3.17.0"
resolved "https://registry.yarnpkg.com/terser/-/terser-3.17.0.tgz#f88ffbeda0deb5637f9d24b0da66f4e15ab10cb2" resolved "https://registry.yarnpkg.com/terser/-/terser-3.17.0.tgz#f88ffbeda0deb5637f9d24b0da66f4e15ab10cb2"
integrity sha512-/FQzzPJmCpjAH9Xvk2paiWrFq+5M6aVOf+2KRbwhByISDX/EujxsK+BAvrhb6H+2rtrLCHK9N01wO014vrIwVQ== integrity sha512-/FQzzPJmCpjAH9Xvk2paiWrFq+5M6aVOf+2KRbwhByISDX/EujxsK+BAvrhb6H+2rtrLCHK9N01wO014vrIwVQ==
@ -11969,14 +11964,6 @@ uglify-js@^2.6.1:
optionalDependencies: optionalDependencies:
uglify-to-browserify "~1.0.0" uglify-to-browserify "~1.0.0"
uglify-js@^3.5.9:
version "3.5.9"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.5.9.tgz#372fbf95939555b1f460b1777d33a67d4a994ac9"
integrity sha512-WpT0RqsDtAWPNJK955DEnb6xjymR8Fn0OlK4TT4pS0ASYsVPqr5ELhgwOwLCP5J5vHeJ4xmMmz3DEgdqC10JeQ==
dependencies:
commander "~2.20.0"
source-map "~0.6.1"
uglify-to-browserify@~1.0.0: uglify-to-browserify@~1.0.0:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"