Closed Ame-ReIori closed 3 months ago
Hi, I'm sorry this is not possible.
Browsers do not provide a way to load a native shared library, this would be a massive security risk. If you want to run native code in the browser, you must target WASM build with the native code (with Emscripten, or wasi-sdk, or whatever else). The WASM build will have very limited access to the system in any case.
Alternatively, if the native code must run on the target system (because, for example, it interacts with specific hardware, or whatever) but you want to provide a web configuration page, you could ask your users to install something on their system that runs in the background, and configure it through a localhost HTTP server or something like that.
Hi, I'm focusing on the situation where the web server provides a web page, including some libraries (.so, .dylib, .dll), and the client can download the libraries and load them in his browser without any communication.
I know that websocket is widely used but it doesn't meet my requirement. Since the client should load the library in the local browser, I wrote a module with koffi in nodejs and tried to import it in vue.
The code in nodejs works. I export the incremental function
inc
as follows:Then the following is my test code.
It works as expected. Then I want to combine it with vue and edit the file
src/App.vue
.My
package.json
is as follows and then I runnpm run dev
.However, there are some errors like
No loader is configured for ".node" files: node_modules/koffi/build/koffi/darwin_arm64/koffi.node
.I have searched it on Google but it seems that no one met the same problem. So, how can I use koffi in vue? Or is there any other apt methods to achieve my requirement?
I list the complete
src/App.vue
and errors as follows:src/App.vue
errors