Open marekpetak opened 8 years ago
The syntax "require(some_module)" is a javascript syntax not Node.js's syntax. and you can write javascript between tags and i hope this solves your problem
To solves problem:
in index.html delete all tags. in app.js add index.js as prelod and add nodeIntegration option:
var electron = require('electron')
var path = require('path')
electron.app.on('ready', function () {
var mainWindow = new electron.BrowserWindow({width: 600, height: 800, webPreferences: {
preload: path.join(__dirname, 'index.js'),
nodeIntegration: true
}})
mainWindow.loadURL('file://' + __dirname + '/index.html')
})
in index.js wrap code in event:
window.addEventListener('DOMContentLoaded', () => {
require(some module)
})
Hi,
I'm sort of new to node and getting through this excersise I've seen file index.js being referenced in index.html. index.js is using node's require function. how does this reference work through html. you don't use require.js either...