Selaa lähdekoodia

no source map in min

sebavan 6 vuotta sitten
vanhempi
commit
e0a078823f
1 muutettua tiedostoa jossa 16 lisäystä ja 13 poistoa
  1. 16 13
      Tools/Gulp/tasks/gulpTasks-libraries.js

+ 16 - 13
Tools/Gulp/tasks/gulpTasks-libraries.js

@@ -44,19 +44,6 @@ var buildExternalLibrariesMultiEntry = function(libraries, settings, isMin) {
     // Webpack Config.
     var wpConfig = require(settings.build.webpack);
 
-    // Map Output
-    var rootPath = path.resolve(__dirname, "../../../");
-    var absoluteSrc = path.resolve(__dirname, "../", settings.build.srcDirectory);
-    wpConfig.output.devtoolModuleFilenameTemplate = (info) => {
-        info.resourcePath = path.normalize(info.resourcePath);
-
-        if (!path.isAbsolute(info.resourcePath)) {
-            info.resourcePath = path.join(absoluteSrc, info.resourcePath);
-        }
-
-        return `webpack://BABYLONJS/${path.relative(rootPath, info.resourcePath).replace(/\\/g, "/")}`;
-    };
-
     // Create multi entry list.
     wpConfig.entry = { };
     for (let library of settings.libraries) {
@@ -66,9 +53,25 @@ var buildExternalLibrariesMultiEntry = function(libraries, settings, isMin) {
 
     // Create output by type (min vs max).
     if (isMin) {
+        delete wpConfig.devtool;
         wpConfig.output.filename = isMinOutputName ? '[name].min.js' : '[name].js';
+        wpConfig.output.devtoolModuleFilenameTemplate
     }
     else {
+        // Map Output
+        wpConfig.devtool = "source-map";
+        var rootPath = path.resolve(__dirname, "../../../");
+        var absoluteSrc = path.resolve(__dirname, "../", settings.build.srcDirectory);
+        wpConfig.output.devtoolModuleFilenameTemplate = (info) => {
+            info.resourcePath = path.normalize(info.resourcePath);
+
+            if (!path.isAbsolute(info.resourcePath)) {
+                info.resourcePath = path.join(absoluteSrc, info.resourcePath);
+            }
+
+            return `webpack://BABYLONJS/${path.relative(rootPath, info.resourcePath).replace(/\\/g, "/")}`;
+        };
+
         // Generate unminified file.
         wpConfig.mode = "development";
         wpConfig.output.filename = isMinOutputName ? '[name].js' : '[name].max.js';