Skip to content
Permalink
Browse files

fix(cli): 文件压缩出错提示错误文件位置

  • Loading branch information...
luckyadam committed Oct 16, 2018
1 parent e90885a commit e02402d00a77a7f49d292df14db33b24fce6a932
Showing with 5 additions and 0 deletions.
  1. +1 −0 packages/taro-cli/src/util/resolve_npm_files.js
  2. +4 −0 packages/taro-cli/src/weapp.js
@@ -179,6 +179,7 @@ function recursiveRequire (filePath, files, isProduction, npmConfig = {}) {
const uglifyConfig = Object.assign(defaultUglifyConfig, uglifyPluginConfig.config || {})
const uglifyResult = npmProcess.callPluginSync('uglifyjs', fileContent, outputNpmPath, uglifyConfig)
if (uglifyResult.error) {
printLog(pocessTypeEnum.ERROR, '压缩错误', `文件${filePath}`)
console.log(uglifyResult.error)
} else {
fileContent = uglifyResult.code
@@ -960,6 +960,7 @@ async function buildEntry () {
const uglifyConfig = Object.assign(defaultUglifyConfig, uglifyPluginConfig.config || {})
const uglifyResult = npmProcess.callPluginSync('uglifyjs', resCode, entryFilePath, uglifyConfig)
if (uglifyResult.error) {
Util.printLog(Util.pocessTypeEnum.ERROR, '压缩错误', `文件${entryFilePath}`)
console.log(uglifyResult.error)
} else {
resCode = uglifyResult.code
@@ -1169,6 +1170,7 @@ async function buildSinglePage (page) {
const uglifyConfig = Object.assign(defaultUglifyConfig, uglifyPluginConfig.config || {})
const uglifyResult = npmProcess.callPluginSync('uglifyjs', resCode, outputPageJSPath, uglifyConfig)
if (uglifyResult.error) {
Util.printLog(Util.pocessTypeEnum.ERROR, '压缩错误', `文件${pageJs}`)
console.log(uglifyResult.error)
} else {
resCode = uglifyResult.code
@@ -1507,6 +1509,7 @@ async function buildSingleComponent (componentObj, buildConfig = {}) {
const uglifyConfig = Object.assign(defaultUglifyConfig, uglifyPluginConfig.config || {})
const uglifyResult = npmProcess.callPluginSync('uglifyjs', resCode, outputComponentJSPath, uglifyConfig)
if (uglifyResult.error) {
Util.printLog(Util.pocessTypeEnum.ERROR, '压缩错误', `文件${component}`)
console.log(uglifyResult.error)
} else {
resCode = uglifyResult.code
@@ -1652,6 +1655,7 @@ function compileDepScripts (scriptFiles) {
const uglifyConfig = Object.assign(defaultUglifyConfig, uglifyPluginConfig.config || {})
const uglifyResult = npmProcess.callPluginSync('uglifyjs', resCode, item, uglifyConfig)
if (uglifyResult.error) {
Util.printLog(Util.pocessTypeEnum.ERROR, '压缩错误', `文件${item}`)
console.log(uglifyResult.error)
} else {
resCode = uglifyResult.code

0 comments on commit e02402d

Please sign in to comment.
You can’t perform that action at this time.