Skip to content

Commit 47bdf63

Browse files
committed
add one more workaround of a webpack dev server bug on IE global methods, close #1161
1 parent 7ca321f commit 47bdf63

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Changelog
22
##### Unreleased
3+
- Added one more workaround of a `webpack` dev server bug on IE global methods, [#1161](https://github.com/zloirock/core-js/issues/1161)
34
- Used non-standard V8 `Error.captureStackTrace` instead of stack parsing in new error classes / wrappers where it's possible
45
- Fixed possible `String.{ raw, cooked }` error with empty template array
56
- Refactoring, some minor optimizations

packages/core-js/internals/microtask.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ if (!microtask) {
6464
// - onreadystatechange
6565
// - setTimeout
6666
} else {
67-
// strange IE + webpack dev server bug - use .bind(global)
67+
// `webpack` dev server bug on IE global methods - use bind(fn, global)
6868
macrotask = bind(macrotask, global);
6969
notify = function () {
7070
macrotask(flush);

packages/core-js/modules/web.atob.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
var $ = require('../internals/export');
2+
var global = require('../internals/global');
23
var getBuiltIn = require('../internals/get-built-in');
34
var uncurryThis = require('../internals/function-uncurry-this');
5+
var call = require('../internals/function-call');
46
var fails = require('../internals/fails');
57
var toString = require('../internals/to-string');
68
var hasOwn = require('../internals/has-own-property');
@@ -36,7 +38,8 @@ var WRONG_ARITY = !NO_SPACES_IGNORE && !NO_ENCODING_CHECK && $atob.length !== 1;
3638
$({ global: true, enumerable: true, forced: NO_SPACES_IGNORE || NO_ENCODING_CHECK || NO_ARG_RECEIVING_CHECK || WRONG_ARITY }, {
3739
atob: function atob(data) {
3840
validateArgumentsLength(arguments.length, 1);
39-
if (NO_ARG_RECEIVING_CHECK || WRONG_ARITY) return $atob(data);
41+
// `webpack` dev server bug on IE global methods - use call(fn, global, ...)
42+
if (NO_ARG_RECEIVING_CHECK || WRONG_ARITY) return call($atob, global, data);
4043
var string = replace(toString(data), whitespaces, '');
4144
var output = '';
4245
var position = 0;

packages/core-js/modules/web.btoa.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
var $ = require('../internals/export');
2+
var global = require('../internals/global');
23
var getBuiltIn = require('../internals/get-built-in');
34
var uncurryThis = require('../internals/function-uncurry-this');
5+
var call = require('../internals/function-call');
46
var fails = require('../internals/fails');
57
var toString = require('../internals/to-string');
68
var validateArgumentsLength = require('../internals/validate-arguments-length');
@@ -25,7 +27,8 @@ var WRONG_ARITY = !!$btoa && $btoa.length !== 1;
2527
$({ global: true, enumerable: true, forced: NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY }, {
2628
btoa: function btoa(data) {
2729
validateArgumentsLength(arguments.length, 1);
28-
if (NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY) return $btoa(toString(data));
30+
// `webpack` dev server bug on IE global methods - use call(fn, global, ...)
31+
if (NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY) return call($btoa, global, toString(data));
2932
var string = toString(data);
3033
var output = '';
3134
var position = 0;

0 commit comments

Comments
 (0)