Skip to content

Instantly share code, notes, and snippets.

@laurentsenta
Created November 2, 2018 09:35
Show Gist options
  • Save laurentsenta/b66a4f21dab0fa757dda88b1d33f407c to your computer and use it in GitHub Desktop.
Save laurentsenta/b66a4f21dab0fa757dda88b1d33f407c to your computer and use it in GitHub Desktop.
With electron-is-dev
// https://gist.github.com/lsenta/36fa6d913dffa1d3218d212e0067056f#file-electron-js
...
const isDev = require("electron-is-dev")
...
function createWindow() {
...
if (isDev) {
// connect to create-react-app dev server
mainWindow.loadURL("http://localhost:3000")
}
else {
// use package build file
mainWindow.loadURL(`file://${path.join(__dirname, "../build/index.html")}`)
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment