Merge pull request #2342 from lbryio/build-fixes

Fix a lot of broken things, apply prod optimizations
This commit is contained in:
Shawn K 2019-03-15 17:13:31 -05:00 committed by GitHub
commit d1577b1380
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 4 deletions

View file

@ -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",

View file

@ -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();

View file

@ -144,6 +144,14 @@ class MediaPlayer extends React.PureComponent<Props, State> {
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,

View file

@ -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,
},

View file

@ -53,6 +53,7 @@ if (process.env.NODE_ENV === 'production') {
mainConfig = merge(mainConfig, {
externals: {
keytar: 'require("keytar")',
electron: 'require("electron")',
},
});
} else {