Skip to content

Commit

Permalink
Fixed is_dev using electron-is-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
eveningkid committed Apr 22, 2018
1 parent f333c2f commit cfef4c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"prettier": "prettier --write '{,!(node_modules)/}**/*.{js,jsx}'",
"electron": "electron .",
"electron:dev": "concurrently \"yarn start\" \"wait-on http://localhost:3000 && yarn run electron\"",
"pack": "yarn build && electron-builder --dir",
"release": "yarn build && electron-builder"
"pack": "ELECTRON_IS_DEV=0 yarn build && ELECTRON_IS_DEV=0 electron-builder --dir",
"release": "ELECTRON_IS_DEV=0 yarn build && ELECTRON_IS_DEV=0 electron-builder"
},
"lint-staged": {
"*.{js,jsx}": [
Expand Down Expand Up @@ -64,6 +64,7 @@
"dotenv": "4.0.0",
"dotenv-expand": "^4.2.0",
"electron-is": "^2.4.0",
"electron-is-dev": "^0.3.0",
"electron-log": "^2.2.14",
"electron-store": "^1.3.0",
"electron-updater": "^2.21.1",
Expand Down
6 changes: 4 additions & 2 deletions public/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const electron = require('electron');
const sweet = require('sweet-electron')(electron);

// Temporary fix for `sweet-electron`.is failure on `.url`
const isDev = require('electron-is-dev');

// Fix $PATH on macOS
require('fix-path')();

Expand All @@ -11,8 +14,7 @@ const events = require('./window/events');

sweet()
.url(
is =>
is.dev() ? 'http://localhost:3000' : [__dirname, '../build/index.html']
() => (isDev ? 'http://localhost:3000' : [__dirname, '../build/index.html'])
)
.window(windowConfiguration)
.menu(menu)
Expand Down

0 comments on commit cfef4c0

Please sign in to comment.