Embed promise polyfill into the main core js
authorAlexander Ebert <ebert@woltlab.com>
Fri, 29 Sep 2017 14:55:41 +0000 (16:55 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 29 Sep 2017 14:55:41 +0000 (16:55 +0200)
Closes #2430

com.woltlab.wcf/templates/headIncludeJavaScript.tpl
extra/_buildCore.js
wcfsetup/install/files/acp/templates/header.tpl

index 4e07f2560f0ec7109b2140e5ac8ed2961372568c..92dc326366b87db2457a51339a75f91f3c3f8d7b 100644 (file)
@@ -22,7 +22,7 @@
        {/if}
 </script>
 
-{js application='wcf' lib='polyfill' file='promise' core='true'}
+{js application='wcf' lib='polyfill' file='promise' bundle='WoltLabSuite.Core' core='true'}
 {js application='wcf' file='require' bundle='WoltLabSuite.Core' core='true' hasTiny=true}
 {js application='wcf' file='require.config' bundle='WoltLabSuite.Core' core='true' hasTiny=true}
 {js application='wcf' file='require.linearExecution' bundle='WoltLabSuite.Core' core='true' hasTiny=true}
index a82a6580a27cb972c30d9e5fdfcca9dbab525170..2338f1837bc18f21464b3f85628f1924f41a77b3 100644 (file)
@@ -79,6 +79,8 @@ process.chdir("../../");
     let configFile = "require.build.js";
     let outFilename = require(process.cwd() + `/${configFile}`).out;
 
+    const promisePolyfill = fs.readFileSync("./3rdParty/polyfill/promise.min.js");
+
     [true, false].forEach(COMPILER_TARGET_DEFAULT => {
         let overrides = "uglify2.compress.global_defs.COMPILER_TARGET_DEFAULT=" + (COMPILER_TARGET_DEFAULT ? "true" : "false");
         if (!COMPILER_TARGET_DEFAULT) {
@@ -92,6 +94,10 @@ process.chdir("../../");
             stdio: [0, 1, 2]
         });
         console.timeEnd(outFilename);
+
+        // prepend the promise polyfill
+        let content = `// promise.min.js\n${promisePolyfill}\n\n// ${outFilename}\n` + fs.readFileSync(outFilename);
+        fs.writeFileSync(outFilename, content);
     });
 }
 
index 5ac13db76fbb249a7cf108dd9fb4d756106a27cc..0bad94e026c1d5a97de8f47d2eeef1fc8278b08f 100644 (file)
@@ -37,6 +37,7 @@
                var COMPILER_TARGET_DEFAULT = true;
        </script>
        
+       {js application='wcf' lib='polyfill' file='promise' bundle='WoltLabSuite.Core' core='true'}
        {js application='wcf' file='require' bundle='WoltLabSuite.Core' core='true'}
        {js application='wcf' file='require.config' bundle='WoltLabSuite.Core' core='true'}
        {js application='wcf' file='require.linearExecution' bundle='WoltLabSuite.Core' core='true'}