From c0cb8e3cf475ce126e5b4f078c22ba84718fd812 Mon Sep 17 00:00:00 2001 From: VisualSJ Date: Wed, 29 Jun 2016 11:10:37 +0800 Subject: [PATCH 1/2] Fixed a bug --- gulp/tasks/modular.js | 2 +- index.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gulp/tasks/modular.js b/gulp/tasks/modular.js index 7da5d47983..93a82c1285 100644 --- a/gulp/tasks/modular.js +++ b/gulp/tasks/modular.js @@ -133,7 +133,7 @@ function wrapFile() { }); var footerFile = new File({ cwd: cwd, base: cwd, path: Path.resolve('footer.js'), - contents: new Buffer('\n}).call(window, cc, ccui, ccs, cp);\n') + contents: new Buffer('\n}).call(window, cc, ccui, ccs, cp);\nexports.success=true;\n') }); var isHeaderInserted = false; return es.through(function (file) { diff --git a/index.js b/index.js index b53710bcbc..57ff7deead 100644 --- a/index.js +++ b/index.js @@ -48,8 +48,10 @@ require('./predefine'); var isMainProcess = CC_EDITOR && Editor.isMainProcess; if (!isMainProcess) { // LOAD ORIGIN COCOS2D COMPILED BY CLOSURE - require('./bin/modular-cocos2d'); - require('./bin/modular-cocos2d-cut'); + var modular = require('./bin/modular-cocos2d'); + if (!modular || !modular.success) { + require('./bin/modular-cocos2d-cut'); + } } else { // load modules for editor's core-level which included in modular-cocos2d.js From 2e83444cde8a5786e3f47621e0ab946fb6289ff5 Mon Sep 17 00:00:00 2001 From: VisualSJ Date: Wed, 29 Jun 2016 11:45:30 +0800 Subject: [PATCH 2/2] Fixed a bug --- gulp/tasks/engine.js | 3 ++- gulp/tasks/modular.js | 2 +- index.js | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gulp/tasks/engine.js b/gulp/tasks/engine.js index afda865e9e..c2d8dd1eab 100644 --- a/gulp/tasks/engine.js +++ b/gulp/tasks/engine.js @@ -118,7 +118,8 @@ exports.buildPreview = function (sourceFile, outputFile, callback) { var outDir = Path.dirname(outputFile); var bundler = Utils.createBundler(sourceFile); - bundler.exclude('./bin/modular-cocos2d-cut.js') + bundler + .ignore('./bin/modular-cocos2d-cut.js') .bundle() .on('error', HandleErrors.handler) .pipe(HandleErrors()) diff --git a/gulp/tasks/modular.js b/gulp/tasks/modular.js index 93a82c1285..7da5d47983 100644 --- a/gulp/tasks/modular.js +++ b/gulp/tasks/modular.js @@ -133,7 +133,7 @@ function wrapFile() { }); var footerFile = new File({ cwd: cwd, base: cwd, path: Path.resolve('footer.js'), - contents: new Buffer('\n}).call(window, cc, ccui, ccs, cp);\nexports.success=true;\n') + contents: new Buffer('\n}).call(window, cc, ccui, ccs, cp);\n') }); var isHeaderInserted = false; return es.through(function (file) { diff --git a/index.js b/index.js index 57ff7deead..99d865c50d 100644 --- a/index.js +++ b/index.js @@ -48,8 +48,8 @@ require('./predefine'); var isMainProcess = CC_EDITOR && Editor.isMainProcess; if (!isMainProcess) { // LOAD ORIGIN COCOS2D COMPILED BY CLOSURE - var modular = require('./bin/modular-cocos2d'); - if (!modular || !modular.success) { + require('./bin/modular-cocos2d'); + if (!CC_EDITOR) { require('./bin/modular-cocos2d-cut'); } }