答案 0 :(得分:0)
我发现这样做的最好方法是使用path.join,只需要很少的努力就可以了,这对您有用吗?
# IMPORT PATH ES6/7
# es6: const path = require('path');
# CONSTRUCT YOUR BUILD PATH
const build_path = path.join(__dirname), '/build');
# mainWindow.loadURL('file://' + build_path + '/index.html')
console.log('file://' + build_path + '/index.html');
# -> file://build/index.html