Updated build config, fixed issue on Windows
authorAlexander Ebert <ebert@woltlab.com>
Mon, 8 May 2017 10:39:04 +0000 (12:39 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 8 May 2017 10:39:04 +0000 (12:39 +0200)
wcfsetup/install/files/js/require.build.js

index a7e28837505fcccceaa0a342d47915dd5123eb71..f44137974f92ff55b22641d407e43e92370ad78e 100644 (file)
@@ -7,7 +7,26 @@
                useStrict: true,
                preserveLicenseComments: false,
                optimize: 'uglify2',
-               uglify2: {},
+               uglify2: {
+                       compress: {
+                               sequences: true,
+                               properties: true,
+                               dead_code: true,
+                               conditionals: true,
+                               comparisons: true,
+                               booleans: true,
+                               loops: true,
+                               hoist_funs: true,
+                               hoist_vars: true,
+                               if_return: true,
+                               join_vars: true,
+                               cascade: true,
+                               /* this is basically the `--define` argument */
+                               global_defs: {
+                                       COMPILER_TARGET_DEFAULT: false
+                               }
+                       }
+               },
                paths: {
                        "requireLib": "require",
                        
@@ -44,7 +63,7 @@
                                        while (folder = queue.shift()) {
                                                var files = fs.readdirSync(folder);
                                                for (var i = 0; i < files.length; i++) {
-                                                       var filename = path.join(folder, files[i]);
+                                                       var filename = path.join(folder, files[i]).replace(/\\/g, '/');
                                                        if (filename === 'WoltLabSuite/Core/Acp') continue;
                                                        
                                                        if (path.extname(filename) == '.js') {
@@ -68,7 +87,8 @@
        require._isSupportedBuildUrl = function (url) {
                var result = _isSupportedBuildUrl(url);
                if (!result) return result;
-               if (Object.keys(config.rawText).map(function (item) { return process.cwd() + '/' + item + '.js'; }).indexOf(url) !== -1) return result;
+               
+               if (Object.keys(config.rawText).map(function (item) { return (process.cwd() + '/' + item + '.js').replace(/\\/g, '/'); }).indexOf(url.replace(/\\/g, '/')) !== -1) return result;
 
                var fs = module.require('fs');
                try {