Skip to content

Commit 021d004

Browse files
committed
Fix "Invalid calling object" in Edge and ES6 syntax error in IE
* Wrap indirect `setImmediate` into function to prevent "Invalid calling object" error in IE/Edge (due to a bug it's an error to call `setImmediate` indirectly). * Fix `babel-loader` include condition to transpile `rdf-canonize` dependency.
1 parent 9aa1334 commit 021d004

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

.browserslistrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ie 10

lib/util.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ api.IdentifierIssuer = IdentifierIssuer;
3030
// from https://github.com/caolan/async/blob/master/lib/async.js
3131

3232
// capture the global reference to guard against fakeTimer mocks
33-
const _setImmediate = typeof setImmediate === 'function' && setImmediate;
33+
const _setImmediate = typeof setImmediate === 'function'
34+
// not a direct alias to prevent "Invalid calling object" error in IE and Edge
35+
? fn => setImmediate(fn)
36+
: undefined;
3437

35-
const _delay = _setImmediate ?
36-
// not a direct alias (for IE10 compatibility)
37-
fn => _setImmediate(fn) :
38-
fn => setTimeout(fn, 0);
38+
const _delay = _setImmediate || (fn => setTimeout(fn, 0));
3939

4040
if(typeof process === 'object' && typeof process.nextTick === 'function') {
4141
api.nextTick = process.nextTick;

webpack.config.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,10 @@ outputs.forEach(info => {
6060
rules: [
6161
{
6262
test: /\.js$/,
63-
include: [{
64-
// exclude node_modules by default
65-
exclude: /(node_modules)/
66-
}, {
67-
// include rdf-canonize
68-
include: /(node_modules\/rdf-canonize)/
69-
}],
63+
include: [
64+
path.join(__dirname, 'lib'),
65+
path.join(__dirname, 'node_modules', 'rdf-canonize'),
66+
],
7067
use: {
7168
loader: 'babel-loader',
7269
options: {

0 commit comments

Comments
 (0)