From 542ebfc4969812b577aabf6d14bee9bb41f84684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Fri, 8 Jan 2021 10:20:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=89=93=E5=8C=85=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pack.config.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pack.config.js b/pack.config.js index 3dc700a..718c3bc 100644 --- a/pack.config.js +++ b/pack.config.js @@ -4,13 +4,11 @@ * @date 2018-08-04 01:00:06 */ -'use strict' - require('es.shim') const fs = require('iofs') const path = require('path') const chokidar = require('chokidar') -const uglify = require('terser') +const { minify } = require('terser') const chalk = require('chalk') const config = require('./package.json') const log = console.log @@ -137,8 +135,11 @@ function packAndCompress() { */ log('正在打包 anot.js...') let normalVerPack = Buffer.concat([PAD_START, normalVer, PAD_END]).toString() - fs.echo(comment() + uglify.minify(normalVerPack).code, './dist/anot.js') - log(chalk.green('anot.js 打包压缩完成!')) + + minify(normalVerPack, { sourceMap: false }).then(res => { + fs.echo(comment() + res.code, './dist/anot.js') + log(chalk.green('anot.js 打包压缩完成!')) + }) /** * -------------------------------------------------------- @@ -148,11 +149,10 @@ function packAndCompress() { log('正在打包 anot.touch.js...') let touchVerPack = Buffer.concat([PAD_START, touchVer, PAD_END]).toString() - fs.echo( - comment({ touch: true }) + uglify.minify(touchVerPack).code, - './dist/anot.touch.js' - ) - log(chalk.green('anot.touch.js 打包压缩完成!')) + minify(touchVerPack, { sourceMap: false }).then(res => { + fs.echo(comment({ touch: true }) + res.code, './dist/anot.touch.js') + log(chalk.green('anot.touch.js 打包压缩完成!')) + }) } let args = process.argv.slice(2)