Przeglądaj źródła

Fixing the playground error.

Local dependency will work now (again, based on babylon's director structure)
Raanan Weber 7 lat temu
rodzic
commit
bc1de6a578
1 zmienionych plików z 3 dodań i 2 usunięć
  1. 3 2
      Tools/Gulp/gulp-addModuleExports.js

+ 3 - 2
Tools/Gulp/gulp-addModuleExports.js

@@ -4,8 +4,9 @@ var through = require('through2');
 module.exports = function (varName, subModule, extendsRoot) {
     return through.obj(function (file, enc, cb) {
 
-        var optionalRequire = 'var BABYLON = BABYLON || (typeof require !== \'undefined\' && require("babylonjs"));\n'
-
+        var optionalRequire = `var babylonDependency; try { babylonDependency = BABYLON || (typeof require !== 'undefined' && require("../babylon.max")); } catch (e) { babylonDependency = BABYLON || (typeof require !== 'undefined' && require("babylonjs")); } 
+var BABYLON = babylonDependency;
+`;
         function moduleExportAddition(varName) {
 
             let basicInit = `root["BABYLON"]${(subModule && !extendsRoot) ? '["' + varName + '"]' : ''} = factory();`;