How to use require() in Electron?
<p>I use for the first time <strong>electron</strong> and <strong>webchimera</strong>. I see this <a href="https://github.com/jaruba/node-vlcPlayer-demo" rel="nofollow noreferrer">demo</a>, but I don't want open in main window the player. I do not know good use electron so I try with a server that renders a index page and, after a button click, the player-page.</p>

<p>Client loads from server the index page:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>//this is for webchimera
if (process.platform == 'win32')
    process.env['VLC_PLUGIN_PATH'] = require('path').join(__dirname, 'node_modules/wcjs-prebuilt/bin/plugins');


const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win

function createWindow () {
  // Create the browser window.
  win = new BrowserWindow({width: 800, height: 600})

  // and load the index.html of the app.
  win.loadURL("http://localhost:8888/")

  // Open the DevTools.
  win.webContents.openDevTools()

  // Emitted when the window is closed.
  win.on('closed', () =&gt; {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    win = null
  })
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', () =&gt; {
  // On macOS it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

app.on('activate', () =&gt; {
  // On macOS it's common to re-create a window in the app when the
  // dock icon is clicked and there are no other windows open.
  if (win === null) {
    createWindow()
  }
})

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.</code></pre>
</div>
</div>
</p>

<p>The index page contains a link to player page, if it clicked the server responds with the player page.
The server is in nodejs.</p>

<p>Server run in localhost:8888 and it sends this html page:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
&lt;head&gt;
  &lt;style&gt;
  body,html{ width: 100%; height: 100%; padding: 0px; margin:0px }
  #player { width: 100%; height: 100% }
  &lt;/style&gt;
&lt;/head&gt;
  
&lt;body&gt;
  &lt;div id="player"&gt;&lt;/div&gt;
  &lt;script&gt;
  var wjs = require("wcjs-player");
  var player = new wjs("#player").addPlayer({
    autoplay: true,
    wcjs: require('wcjs-prebuilt')
  });
  player.addPlaylist("http://archive.org/download/CartoonClassics/Krazy_Kat_-    _Keeping_Up_With_Krazy.mp4");
  &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
</div>
</div>
</p>

<p>But I obtain this error: 
<code>cannot find module wcjs-player</code></p>

<p>How can I fix this?</p>

<p><strong>PS</strong>:
I use a server only because I wrote it for a webapp before I decided to use electron. It not necessary. I can remove the server and use only the client.</p>