-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getFileName() returns undefined when called using eval #50
Comments
ZMQ uses bindings which is incompatible with webpack. Details: bindings tries to reach the directory structure found in the development directory, which is not the case in the dist directory. More details: bindings uses the prepareStackTrace to examine the trace files, and webpack calls zmq--(thus)-->bindings.js through eval which doesn't result in having the filenames accessible through getEvalOrigin() instead of getFileName() follow [this issue](TooTallNate/node-bindings#50).
but webpack st[i].getEvalOrigin() is webpack:///./node_modules/ref/lib/ref.js,it's not a right dir name |
It should work if you specify module using node-bindings as external in webpack configuration (webpack docs) eg. |
I'm using Node 12 and ffi-napi module, compiled through Webpack, and I'm also seeing this:
Think the project owners would accept a pull request that just initializes the fileName to empty string instead of undefined? |
fileName is changed during the function, just initializing it would not work. This however doesn't help you, because when working with webpack, getting this error means that webpack packed this module, which it should not. You must configure webpack to use this module externally, only then you get the low level bindings to work. |
Cool, I was running all my serverside files through Webpack so I can have JSX everywhere and use Still seems like this module could function without caring what file the code is in, but I don't know much about the module. Things are working so I'm happy. |
Yo could have still used webpack for all of the source just by configuring it to use ffi-napi externally |
I am having the same exception, trying to package an Electron app that has a native dependency. I tried adding the module in the externals array of the webpack configuration but then it crashes because it cannot find the module: function(e, t) {
e.exports = drivelist
}
That's how I'm importing drivelist: import * as drivelist from 'drivelist'; Note that I tried to use require instead of import and it leads to the same error.
|
I've been using this non-idea workaround for my native modules in electron and it works for me:
|
#61 <- this might be a better solution (haven't tested) |
Attempt to address TooTallNate#50 (comment) and TooTallNate#61
As a work around, I ended up using webpack for a specific binding that was missing (in electron) and just copying it into the build/Release new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'node_modules', 'forcefocus', 'bin', 'win32-x64-106'),
to: path.resolve(__dirname, 'build', 'Release')
}
]
}) Since I was using electron-forge for my problem, I was also able to get arround it by using Would be nice to have #74 |
@ntbosscher @AnEmortalKid This thread is quite old but just want to ask if you had the same issue when running make ( |
@FrederickThunder it was probably with make, given that I was using the |
What happens:
Bindings fails to get the root dir
Reproduction:
calling bindings through eval
Example: Using webpack and having bindings in a dependency (ie: of zmq)
Analysis:
While getting the file name from the stack trace, getFileName() returns undefined.
As filenames could be stored st[i].getEvalOrigin() not only in st[i].getFileName() based on https://github.com/v8/v8/wiki/Stack-Trace-API
The text was updated successfully, but these errors were encountered: