node-addon-loader
node-addon-loader copied to clipboard
Cannot read property 'nodeAddonLoader' of undefined
Hi, attempted plugin on latest webpack 4.12.0.
Config:
module: {
rules: [
{
test: /\.node$/,
use: {
loader: "node-addon-loader",
options: {}
}
}
]
}
Failing with
Module build failed (from ./node_modules/node-addon-loader/index.js):
TypeError: Cannot read property 'nodeAddonLoader' of undefined
at Object.module.exports (node_modules/node-addon-loader/index.js:16:29)
Sounds like some breaking changes in newest webpack?
Quick googling shows that since webpack 4:
this.options
is going to be this._compiler.options
Don't know if you'd like to support both for backward compatibility.
@dvsekhvalnov did you come right here using webpack 4.x?
Hi @shainegordon , yeah see my message above. We just fixed package locally and it works correctly.
@dvsekhvalnov can you create a pull request?
Hi @grit96 , probably no:
- we moved different direction without addon because hit the wall with dynamically linked dependencies from native module.
- as i commented above our fix was only to make it work under webpack 4 while most likely sacrificing webpack 3 and below. So to make it right probably more work needed to support all webpack versions.