Created
November 2, 2018 09:35
-
-
Save laurentsenta/b66a4f21dab0fa757dda88b1d33f407c to your computer and use it in GitHub Desktop.
With electron-is-dev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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