S
S
Sergey Suntsev2018-05-10 09:48:41
JavaScript
Sergey Suntsev, 2018-05-10 09:48:41

How to add compiled binary to build version via electron-build?

There is an application on electron.js
There is a compiled binary in the node library.
In the dev version everything works fine.
In the prod version, when compiling under win, it gives an error

ERROR in ./kkt-electron-prebuild/native/index.node
[0] Module parse failed: Unexpected character '�' (1:2)
[0] You may need an appropriate loader to handle this file type.
[0] (Source code omitted for this binary file)
[0]  @ ./kkt-electron-prebuild/lib/index.js 3:12-43
[0]  @ ./app/main.dev.js

I use electron-build
UPD:
Adding configuration module for node binaries helped
module: {
    rules: [
      {
        test: /\.node$/,
        use: 'node-loader'
      }
    ]
  }

Now the problem is, for some reason the system does not see the node module ...
Already the console writes "Uncaught Error: Cannot find module 'kkt-electron'"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Suntsev, 2018-05-10
@GreyCrew

In general, what was the point.
Type errors

ERROR in ./kkt-electron-prebuild/native/index.node
[0] Module parse failed: Unexpected character '�' (1:2)

They indicate that there is no module that can work with the corresponding type of files (.node, .jsx, .sass etc)
I need a node-loader to work with .node binaries, I actually connected it in the base config It was
very embarrassing that in the dev version, it worked fine, but this was due to the fact that I included it in the index.html file. But actually, according to this build version of the program, it did not find it. I moved it to root.js (where the provider is connected in react) and it all worked.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question