From e36f4b9c33478b02e522617d03f12c5c83a12144 Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Fri, 17 Feb 2017 18:29:36 +0800 Subject: [PATCH] fix engine bulid error again --- gulp/tasks/utils.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gulp/tasks/utils.js b/gulp/tasks/utils.js index 7b9c038a1e..7d3e97d519 100644 --- a/gulp/tasks/utils.js +++ b/gulp/tasks/utils.js @@ -56,15 +56,20 @@ exports.uglifyOptions = function (minify, global_defs) { function allowReturnOutsideFunctionInBrowserifyTransform () { var acorn; try { - acorn = require('syntax-error/node_modules/acorn'); + acorn = require('browserify/node_modules/syntax-error/node_modules/acorn'); } catch (e) { try { - acorn = require('acorn'); + acorn = require('syntax-error/node_modules/acorn'); } catch (e) { - console.warn('Can not find acorn to patch'); - return; + try { + acorn = require('acorn'); + } + catch (e) { + console.error('Can not find acorn to patch'); + return; + } } } @@ -78,7 +83,7 @@ function allowReturnOutsideFunctionInBrowserifyTransform () { } } else { - console.warn('Can not find acorn.parse to patch'); + console.error('Can not find acorn.parse to patch'); } }