Closed hariaakash closed 2 years ago
Hi @hariaakash,
Try opening up vuelectro.config.js
and adding ipc/index.js
to vMain
source files. Like this.
// Configuration for the main process
vMain: {
srcFiles: [
'electron-main.js',
'preload.js',
'ipc/index.js'
]
Tried that and the build still showed that same error
Just took a look at your source code. Here's what it should be.
vuelectro.config.js
:
// Configuration for the main process
vMain: {
srcFiles: [
'electron-main.js',
'preload.js',
'ipc/index.js',
'helpers/axios.js',
'helpers/cron.js',
'helpers/store.js'
]
Also get rid of the path.resolve()
in your require()
statement.
electron-main.js
:
require('./ipc');
Just make sure to add any source file that will potentially be used in the main process to srcFiles
in vMain
vuelectro configuration. 🙂
BTW, you gave me an idea though. I should add glob support for srcFiles
possibly in the next release. Then you could simply add helpers/*.js
and it would work.
Thanks @m4heshd and yea the global support would be very handy as I have more files to handle
I'm gonna keep this open for the moment so the enhancement idea is not lost in closed issues.
Glob support has been added in f086a45aad766b6b344dc8d898f1ebe6b23160ea.
Hi, thanks for this amazing project. I'm new to this electron framework, after jumping around multiple docs and packages this one really did help me get started. Am facing this error only on build apps, any help/guidance is appreciated. When serving locally the app works fine whereas when building the ipcMain handler is not registered.
Here is code: IPC File:
How I am importing it in electron-main.js
require(path.resolve('./src/ipc'))
How I am using this in vue:
But when running this on production build the following error is thrown:
Edit: Repo https://github.com/hariaakash/tabeazy-connector