Require ffi-napi on browser

Viewed 127

I am trying to create a local browser-based application. I need to have access to some dlls so I used a module called ffi-napi:

Example (what I need to use is not specifically the libm module, just simplifying the example):

    var ffi = require('ffi-napi')

    var libm = ffi.Library('libm', {
      'ceil': ['double', ['double']]
    })
    libm.ceil(1.5)

This works fine when on I am running on Electron. But when I compile it for use with the browser, I am getting this error message (which is being thrown by Webpack/node-gyp-build:

Error in mounted hook: "ReferenceError: require is not defined"

I understand that require is not native on the browser mode, but the framework I am using, I believe, already has browserify integrated (I am using Quasar framework). I think so because the other local modules I can use require() on the browser just fine.

Is there any way I can use ffi-napi on the browser?

Help!

0 Answers
Related