Documentation on using with webpack
doug-a-brunner opened this issue · 2 comments
I just discovered after some digging that, for a module to work with node-bindings
in a project that uses webpack
, that module needs to be included in externals
in webpack.config.js
so that its code ends up in a directory from which its package.json
can be found. Would it make sense to include this in the readme?
If someone else struggles with this, here's what worked for me. I am using the npm package objc
which depends on ref
and ffi
, who in turn depend on bindings
.
Adding bindings
as an external, as suggested in most threads, did not work. Neither did objc
. But this did the trick in webpack.config.js
:
externals: {
ref: 'require("ref")',
ffi: 'require("ffi")'
}
the solution from @erikjalevik didn't work for me, but the module mentioned in this comment helped -> jsdom/jsdom#2066 (comment)