Skip to content

Commit

Permalink
add one more workaround of a webpack dev server bug on IE global me…
Browse files Browse the repository at this point in the history
…thods, close #1161
  • Loading branch information
zloirock committed Jan 10, 2023
1 parent 7ca321f commit 47bdf63
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Changelog
##### Unreleased
- Added one more workaround of a `webpack` dev server bug on IE global methods, [#1161](https://github.com/zloirock/core-js/issues/1161)
- Used non-standard V8 `Error.captureStackTrace` instead of stack parsing in new error classes / wrappers where it's possible
- Fixed possible `String.{ raw, cooked }` error with empty template array
- Refactoring, some minor optimizations
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/microtask.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if (!microtask) {
// - onreadystatechange
// - setTimeout
} else {
// strange IE + webpack dev server bug - use .bind(global)
// `webpack` dev server bug on IE global methods - use bind(fn, global)
macrotask = bind(macrotask, global);
notify = function () {
macrotask(flush);
Expand Down
5 changes: 4 additions & 1 deletion packages/core-js/modules/web.atob.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
var $ = require('../internals/export');
var global = require('../internals/global');
var getBuiltIn = require('../internals/get-built-in');
var uncurryThis = require('../internals/function-uncurry-this');
var call = require('../internals/function-call');
var fails = require('../internals/fails');
var toString = require('../internals/to-string');
var hasOwn = require('../internals/has-own-property');
Expand Down Expand Up @@ -36,7 +38,8 @@ var WRONG_ARITY = !NO_SPACES_IGNORE && !NO_ENCODING_CHECK && $atob.length !== 1;
$({ global: true, enumerable: true, forced: NO_SPACES_IGNORE || NO_ENCODING_CHECK || NO_ARG_RECEIVING_CHECK || WRONG_ARITY }, {
atob: function atob(data) {
validateArgumentsLength(arguments.length, 1);
if (NO_ARG_RECEIVING_CHECK || WRONG_ARITY) return $atob(data);
// `webpack` dev server bug on IE global methods - use call(fn, global, ...)
if (NO_ARG_RECEIVING_CHECK || WRONG_ARITY) return call($atob, global, data);
var string = replace(toString(data), whitespaces, '');
var output = '';
var position = 0;
Expand Down
5 changes: 4 additions & 1 deletion packages/core-js/modules/web.btoa.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
var $ = require('../internals/export');
var global = require('../internals/global');
var getBuiltIn = require('../internals/get-built-in');
var uncurryThis = require('../internals/function-uncurry-this');
var call = require('../internals/function-call');
var fails = require('../internals/fails');
var toString = require('../internals/to-string');
var validateArgumentsLength = require('../internals/validate-arguments-length');
Expand All @@ -25,7 +27,8 @@ var WRONG_ARITY = !!$btoa && $btoa.length !== 1;
$({ global: true, enumerable: true, forced: NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY }, {
btoa: function btoa(data) {
validateArgumentsLength(arguments.length, 1);
if (NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY) return $btoa(toString(data));
// `webpack` dev server bug on IE global methods - use call(fn, global, ...)
if (NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY) return call($btoa, global, toString(data));
var string = toString(data);
var output = '';
var position = 0;
Expand Down

0 comments on commit 47bdf63

Please sign in to comment.