Browse Source

build: use terser instead of uglify

dev
Evan You 6 years ago
parent
commit
980801c8a3
  1. 2
      package.json
  2. 4
      scripts/build.js
  3. 13
      yarn.lock

2
package.json

@ -138,7 +138,7 @@
"serialize-javascript": "^1.3.0", "serialize-javascript": "^1.3.0",
"shelljs": "^0.8.1", "shelljs": "^0.8.1",
"typescript": "^3.1.3", "typescript": "^3.1.3",
"uglify-js": "^3.0.15", "terser": "^3.10.2",
"webpack": "^4.22.0", "webpack": "^4.22.0",
"weex-js-runtime": "^0.23.6", "weex-js-runtime": "^0.23.6",
"weex-styler": "^0.3.0", "weex-styler": "^0.3.0",

4
scripts/build.js

@ -2,7 +2,7 @@ const fs = require('fs')
const path = require('path') const path = require('path')
const zlib = require('zlib') const zlib = require('zlib')
const rollup = require('rollup') const rollup = require('rollup')
const uglify = require('uglify-js') const terser = require('terser')
if (!fs.existsSync('dist')) { if (!fs.existsSync('dist')) {
fs.mkdirSync('dist') fs.mkdirSync('dist')
@ -48,7 +48,7 @@ function buildEntry (config) {
.then(bundle => bundle.generate(output)) .then(bundle => bundle.generate(output))
.then(({ code }) => { .then(({ code }) => {
if (isProd) { if (isProd) {
var minified = (banner ? banner + '\n' : '') + uglify.minify(code, { var minified = (banner ? banner + '\n' : '') + terser.minify(code, {
output: { output: {
ascii_only: true ascii_only: true
}, },

13
yarn.lock

@ -7562,7 +7562,7 @@ source-map-resolve@^0.5.0, source-map-resolve@^0.5.2:
source-map-url "^0.4.0" source-map-url "^0.4.0"
urix "^0.1.0" urix "^0.1.0"
source-map-support@^0.5.9: source-map-support@^0.5.9, source-map-support@~0.5.6:
version "0.5.9" version "0.5.9"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f"
integrity sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA== integrity sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==
@ -7914,6 +7914,15 @@ tar@^4:
safe-buffer "^5.1.2" safe-buffer "^5.1.2"
yallist "^3.0.2" yallist "^3.0.2"
terser@^3.10.2:
version "3.10.2"
resolved "https://registry.yarnpkg.com/terser/-/terser-3.10.2.tgz#a61d2c97065f9fdc8c49a18655e2a80ca7298a94"
integrity sha512-+QrFoqBImmsQGB4c/HvaqgZynmbNvNBwoBxuu7fYXtq5EEtlLUzph+WimDj+xMkuqawXPMl2lgCIz81CdXvt+w==
dependencies:
commander "~2.17.1"
source-map "~0.6.1"
source-map-support "~0.5.6"
test-exclude@^5.0.0: test-exclude@^5.0.0:
version "5.0.0" version "5.0.0"
resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.0.0.tgz#cdce7cece785e0e829cd5c2b27baf18bc583cfb7" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.0.0.tgz#cdce7cece785e0e829cd5c2b27baf18bc583cfb7"
@ -8123,7 +8132,7 @@ uglify-es@^3.3.4:
commander "~2.13.0" commander "~2.13.0"
source-map "~0.6.1" source-map "~0.6.1"
uglify-js@^3.0.15, uglify-js@^3.1.4: uglify-js@^3.1.4:
version "3.4.9" version "3.4.9"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3"
integrity sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q== integrity sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==

Loading…
Cancel
Save