diff --git a/package.json b/package.json index 986f47eae..2360308fd 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "scripts": { "compile:electron": "webpack --progress --config webpack.electron.config.js", "compile:web": "webpack --config webpack.web.config.js", - "compile": "yarn compile:electron && yarn compile:web", + "compile": "cross-env NODE_ENV=production yarn compile:electron && cross-env NODE_ENV=production yarn compile:web", "dev": "yarn dev:electron", "dev:electron": "cross-env NODE_ENV=development node ./src/platforms/electron/devServer.js", "dev:web": "webpack-dev-server --open --hot --progress --config webpack.web.config.js", diff --git a/src/platforms/electron/createTray.js b/src/platforms/electron/createTray.js index 55d9586ac..5cc3203ad 100644 --- a/src/platforms/electron/createTray.js +++ b/src/platforms/electron/createTray.js @@ -3,6 +3,7 @@ import path from 'path'; export default window => { let iconPath; + switch (process.platform) { case 'darwin': { iconPath = 'static/img/tray/mac/trayTemplate.png'; @@ -17,7 +18,9 @@ export default window => { } } - const tray = new Tray(iconPath); + const tray = new Tray( + process.env.NODE_ENV === 'development' ? iconPath : path.join(process.resourcesPath, iconPath) + ); tray.on('double-click', () => { window.show(); diff --git a/src/ui/component/fileViewer/internal/player.jsx b/src/ui/component/fileViewer/internal/player.jsx index f31166c63..dbe94b7ef 100644 --- a/src/ui/component/fileViewer/internal/player.jsx +++ b/src/ui/component/fileViewer/internal/player.jsx @@ -144,6 +144,14 @@ class MediaPlayer extends React.PureComponent { else { // Temp hack to help in some metadata loading cases setTimeout(() => { + + const currentMediaContainer = this.mediaContainer.current; + + // Clean any potential rogue instances + while (currentMediaContainer.firstChild) { + currentMediaContainer.removeChild(currentMediaContainer.firstChild); + } + player.append( { name: fileName, diff --git a/webpack.base.config.js b/webpack.base.config.js index 25fc2ab0f..2a704b0d7 100644 --- a/webpack.base.config.js +++ b/webpack.base.config.js @@ -12,9 +12,9 @@ const UI_ROOT = path.resolve(__dirname, 'src/ui/'); const STATIC_ROOT = path.resolve(__dirname, 'static/'); const DIST_ROOT = path.resolve(__dirname, 'dist/'); -const baseConfig = { +let baseConfig = { mode: ifProduction('production', 'development'), - devtool: ifProduction('source-map', 'eval-source-map'), + devtool: ifProduction(false, 'eval-source-map'), node: { __dirname: false, }, diff --git a/webpack.electron.config.js b/webpack.electron.config.js index f8d50bef2..9a346022f 100644 --- a/webpack.electron.config.js +++ b/webpack.electron.config.js @@ -53,6 +53,7 @@ if (process.env.NODE_ENV === 'production') { mainConfig = merge(mainConfig, { externals: { keytar: 'require("keytar")', + electron: 'require("electron")', }, }); } else {