{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/3531","repository_url":"https://api.github.com/repos/webpack/webpack","labels_url":"https://api.github.com/repos/webpack/webpack/issues/3531/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/3531/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/3531/events","html_url":"https://github.com/webpack/webpack/issues/3531","id":196720666,"number":3531,"title":"JsonpMainTemplatePlugin.js uses Promises to resolve dependencies which is not working in Internet Explorer 9-11","user":{"login":"arusanov","id":459176,"avatar_url":"https://avatars.githubusercontent.com/u/459176?v=3","gravatar_id":"","url":"https://api.github.com/users/arusanov","html_url":"https://github.com/arusanov","followers_url":"https://api.github.com/users/arusanov/followers","following_url":"https://api.github.com/users/arusanov/following{/other_user}","gists_url":"https://api.github.com/users/arusanov/gists{/gist_id}","starred_url":"https://api.github.com/users/arusanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arusanov/subscriptions","organizations_url":"https://api.github.com/users/arusanov/orgs","repos_url":"https://api.github.com/users/arusanov/repos","events_url":"https://api.github.com/users/arusanov/events{/privacy}","received_events_url":"https://api.github.com/users/arusanov/received_events","type":"User","site_admin":false},"labels":[{"id":428473237,"url":"https://api.github.com/repos/webpack/webpack/labels/P2:%20Very%20Important","name":"P2: Very Important","color":"ef7675","default":false},{"id":428472762,"url":"https://api.github.com/repos/webpack/webpack/labels/S4:%20Broken","name":"S4: Broken","color":"0052cc","default":false},{"id":90419071,"url":"https://api.github.com/repos/webpack/webpack/labels/webpack-2","name":"webpack-2","color":"c5def5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-20T16:41:34Z","updated_at":"2016-12-21T08:45:05Z","closed_at":null,"body":"Code splitting with `require.ensure` for webpack 2.2.0-rc.1 generates loader that uses `Promise`\r\n\r\nhttps://github.com/webpack/webpack/blob/f9e57d9a0c4b06d0bc3db5c67721827aa9cf6fcd/lib/JsonpMainTemplatePlugin.js#L102\r\n```\r\n \"\",\r\n\"var promise = new Promise(function(resolve, reject) {\",\r\nthis.indent([\r\n```\r\n\r\nThese prevents splitted modules to run normally in any internet explorer 9-11 cause IE doesn't have `Promise` implementation and polyfill is loaded within one of splitted modules.\r\n\r\nMy generated entry point module looks like this. It loads 2 other modules (1-vendor with Promise implementation, 2 - app code)\r\n\r\n```\r\nvar library = function (n) {\r\n\tfunction e(t) {\r\n\t\tif (r[t])return r[t].exports;\r\n\t\tvar o = r[t] = {i: t, l: !1, exports: {}};\r\n\t\treturn n[t].call(o.exports, o, o.exports, e), o.l = !0, o.exports\r\n\t}\r\n\r\n\tvar t = window.webpackJsonp;\r\n\twindow.webpackJsonp = function (e, r, u) {\r\n\t\tfor (var c, i, a = 0, s = []; a < e.length; a++)i = e[a], o[i] && s.push(o[i][0]), o[i] = 0;\r\n\t\tfor (c in r)Object.prototype.hasOwnProperty.call(r, c) && (n[c] = r[c]);\r\n\t\tfor (t && t(e, r, u); s.length;)s.shift()()\r\n\t};\r\n\tvar r = {}, o = {2: 0};\r\n\treturn e.e = function (n) {\r\n\t\tfunction t() {\r\n\t\t\tu.onerror = u.onload = null, clearTimeout(c);\r\n\t\t\tvar e = o[n];\r\n\t\t\t0 !== e && (e && e[1](new Error(\"Loading chunk \" + n + \" failed.\")), o[n] = void 0)\r\n\t\t}\r\n\r\n\t\tif (0 === o[n])return Promise.resolve();\r\n\t\tif (o[n])return o[n][2];\r\n\t\tvar r = document.getElementsByTagName(\"head\")[0], u = document.createElement(\"script\");\r\n\t\tu.type = \"text/javascript\", u.charset = \"utf-8\", u.async = !0, u.timeout = 12e4, u.crossOrigin = \"anonymous\", e.nc && u.setAttribute(\"nonce\", e.nc), u.src = e.p + \"main.\" + {\r\n\t\t\t\t0: \"cdb3\",\r\n\t\t\t\t1: \"caf4\"\r\n\t\t\t}[n] + \".js\";\r\n\t\tvar c = setTimeout(t, 12e4);\r\n\t\tu.onerror = u.onload = t, r.appendChild(u);\r\n\t\tvar i = new Promise(function (e, t) {\r\n\t\t\to[n] = [e, t]\r\n\t\t});\r\n\t\treturn o[n][2] = i\r\n\t}, e.m = n, e.c = r, e.i = function (n) {\r\n\t\treturn n\r\n\t}, e.d = function (n, t, r) {\r\n\t\te.o(n, t) || Object.defineProperty(n, t, {configurable: !1, enumerable: !0, get: r})\r\n\t}, e.n = function (n) {\r\n\t\tvar t = n && n.__esModule ? function () {\r\n\t\t\t\treturn n.default\r\n\t\t\t} : function () {\r\n\t\t\t\treturn n\r\n\t\t\t};\r\n\t\treturn e.d(t, \"a\", t), t\r\n\t}, e.o = function (n, e) {\r\n\t\treturn Object.prototype.hasOwnProperty.call(n, e)\r\n\t}, e.p = \"\", e.oe = function (n) {\r\n\t\tthrow n\r\n\t}, e(e.s = 4)\r\n}({\r\n\t4: function (n, e, t) {\r\n\t\t\"use strict\";\r\n\t\tfunction r(n, e, r) {\r\n\t\t\tvoid 0 === n && (n = document.body);\r\n\t\t\tvar o = [], u = null, c = function () {\r\n\t\t\t\tfor (var n = 0, e = o; n < e.length; n++) {\r\n\t\t\t\t\tvar t = e[n];\r\n\t\t\t\t\tu.update(t)\r\n\t\t\t\t}\r\n\t\t\t\to.length = 0\r\n\t\t\t};\r\n\t\t\treturn t.e(0).then(function () {\r\n\t\t\t\tt.e(1).then(function (o) {\r\n\t\t\t\t\tu = t(0).run(n, e), c(), \"function\" == typeof r && r(u)\r\n\t\t\t\t}.bind(null, t)).catch(t.oe)\r\n\t\t\t}.bind(null, t)).catch(t.oe), {\r\n\t\t\t\tupdate: function (n) {\r\n\t\t\t\t\tu ? u.update(n) : o.push(n)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tn.exports = r\r\n\t}\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/webpack/webpack/issues/comments/268468066","html_url":"https://github.com/webpack/webpack/issues/3531#issuecomment-268468066","issue_url":"https://api.github.com/repos/webpack/webpack/issues/3531","id":268468066,"user":{"login":"arusanov","id":459176,"avatar_url":"https://avatars.githubusercontent.com/u/459176?v=3","gravatar_id":"","url":"https://api.github.com/users/arusanov","html_url":"https://github.com/arusanov","followers_url":"https://api.github.com/users/arusanov/followers","following_url":"https://api.github.com/users/arusanov/following{/other_user}","gists_url":"https://api.github.com/users/arusanov/gists{/gist_id}","starred_url":"https://api.github.com/users/arusanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arusanov/subscriptions","organizations_url":"https://api.github.com/users/arusanov/orgs","repos_url":"https://api.github.com/users/arusanov/repos","events_url":"https://api.github.com/users/arusanov/events{/privacy}","received_events_url":"https://api.github.com/users/arusanov/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T08:45:04Z","updated_at":"2016-12-21T08:45:04Z","body":"And what if I don't want to use polyfill? I've a `Promise` polyfill bundled into webpack with \r\n```\r\nnew webpack.ProvidePlugin({\r\n\tPromise: 'promiz',\r\n})\r\n```\r\n\r\nSo everything that use promises **in the bundle** works and I don't want to pollute global scope with unneeded polyfills (suppose that I'm writing standalone library with no dependencies)\r\n\r\nIs there any way to use old template for `JsonpMainTemplatePlugin` (from webpack 1.x) or create plugin to do same job as webpack 1 splitting does?\r\n\r\nActually I can't see a lot of benefits by using promises instead of old callbacks in this small chunk of code except for limiting browser support.\r\n "}}
{"actor":{"display_login":"arusanov"}}