Skip to content

Commit 40dcc1f

Browse files
committedNov 21, 2018
Add webpack require hack
1 parent 58141c6 commit 40dcc1f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎bindings.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ function bindings (opts) {
6565
opts.bindings += '.node'
6666
}
6767

68+
// https://github.com/webpack/webpack/issues/4175#issuecomment-342931035
69+
var requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
70+
6871
var tries = []
6972
, i = 0
7073
, l = opts.try.length
@@ -78,7 +81,7 @@ function bindings (opts) {
7881
}))
7982
tries.push(n)
8083
try {
81-
b = opts.path ? require.resolve(n) : require(n)
84+
b = opts.path ? requireFunc.resolve(n) : requireFunc(n)
8285
if (!opts.path) {
8386
b.path = n
8487
}

0 commit comments

Comments
 (0)
Please sign in to comment.