Browser file of the main file of the electronic application

I am creating an electronic application and am currently using a browser for rendering files (web pages), like any other javascript frontend. I would also like to use the browser function to link the main process files. However, browswerify cannot find the electron embedded in modules such as the clipboard, ipc, browser window, application, etc.

In my main.js file, which serves as an entry point for an electronic application. I have:

const ipc = require('ipc'); const clipboard = require('clipboard'); const BrowserWindow = require('browser-window'); const app = require('app'); const yargs = require('yargs'); 

const yargs loads exactly like in the node_modeuls folder, and the browser can enable this. However, these four elements cannot be found using the browser and, consequently, the assembly fails.

 [11:49:17] Finished 'development' after 17 ms Error: Cannot find module 'ipc' from '<path>' Error: Cannot find module 'clipboard' from '<path>' Error: Cannot find module 'browser-window' from '<path>' Error: Cannot find module 'app' from '<path>' 

Any suggestions?

+6
source share
1 answer

Using a browser, you can set the parameters "ignoreMissing" and "detectGlobals", which allow the browser to ignore the built-in modules, which ultimately automatically load into the electronic application.

 browserify({ entries: './src/main.js', extensions: ['.js'], ignoreMissing: true, detectGlobals: false, bare: true, debug: false }) 
+4
source

All Articles