use port 9090 for webpack since internal-apis uses 8080

This commit is contained in:
Sean Yesmunt 2019-05-09 00:35:43 -04:00 committed by Thomas Zarebczan
parent d6c4463c99
commit 9d9976d77a
7 changed files with 16 additions and 17 deletions

View file

@ -19,7 +19,8 @@
"__": true,
"__n": true,
"app": true,
"IS_WEB": true
"IS_WEB": true,
"WEBPACK_PORT": true
},
"rules": {
"comma-dangle": ["error", "always-multiline"],

View file

@ -26,7 +26,7 @@
"dev": "yarn dev:electron",
"dev:electron": "cross-env NODE_ENV=development node ./src/platforms/electron/devServer.js",
"dev:web": "cross-env NODE_ENV=development webpack-dev-server --open --hot --progress --config webpack.web.config.js",
"dev:internal-apis": "LBRY_API_URL='http://localhost:9090' yarn dev:electron",
"dev:internal-apis": "LBRY_API_URL='http://localhost:8080' yarn dev:electron",
"run:web": "cross-env NODE_ENV=production yarn compile:web && node ./dist/web/server.js",
"pack": "electron-builder --dir",
"dist": "electron-builder",

View file

@ -36,7 +36,7 @@ export default appState => {
};
const lbryProto = 'lbry://';
const lbryProtoQ = 'lbry://?';
const rendererURL = isDev ? `http://localhost:8080` : `file://${__dirname}/index.html`;
const rendererURL = isDev ? `http://localhost:${WEBPACK_PORT}` : `file://${__dirname}/index.html`;
let window = new BrowserWindow(windowConfiguration);

View file

@ -1,5 +1,3 @@
const fs = require('fs');
const path = require('path');
const chalk = require('chalk');
const webpack = require('webpack');
const merge = require('webpack-merge');
@ -7,12 +5,9 @@ const middleware = require('webpack-dev-middleware');
const express = require('express');
const app = express();
// TODO: Spawn separate threads so realtime status logging can be used
// without overwriting information/execptions logged by the compilers
const logRealtime = str => {
let lineCount = (str.match(/\n/) || []).length + 1;
console.log('\u001B[' + lineCount + 'F\u001B[G\u001B[2K' + str);
};
// Ideally this would come from the same source that sets this port in webpack.web.config.js
// but we can't inject a variable into this file because it is not being touched by webpack
const WEBPACK_PORT = 9090;
console.log(
chalk.magenta(`Compiling ${chalk.underline('main')} and ${chalk.underline('render')}, this will take a while.`)
@ -46,8 +41,8 @@ app.use(require('webpack-hot-middleware')(renderCompiler));
app.use(renderInstance);
app.use(express.static('dist/electron/static'));
app.listen(8080, () => {
console.log(chalk.yellow.bold('Renderer listening on port 8080 (still compiling)'));
app.listen(WEBPACK_PORT, () => {
console.log(chalk.yellow.bold('Renderer listening on port 9090 (still compiling)'));
});
mainInstance.waitUntilValid(() => console.log(chalk.green(`${chalk.underline('main')} compilation complete.`)));

View file

@ -7,6 +7,6 @@
<body>
<div id="app"></div>
<script type="text/javascript" src="http://localhost:8080/ui.js"></script>
<script type="text/javascript" src="http://localhost:9090/ui.js"></script>
</body>
</html>

View file

@ -12,6 +12,7 @@ const { ifProduction } = getIfUtils(NODE_ENV);
const UI_ROOT = path.resolve(__dirname, 'src/ui/');
const STATIC_ROOT = path.resolve(__dirname, 'static/');
const DIST_ROOT = path.resolve(__dirname, 'dist/');
const WEBPACK_PORT = 9090;
console.log(ifProduction('production', 'development'));
@ -32,6 +33,10 @@ let baseConfig = {
node: {
__dirname: false,
},
devServer: {
historyApiFallback: true,
port: WEBPACK_PORT,
},
module: {
rules: [
{
@ -117,6 +122,7 @@ let baseConfig = {
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
'process.env.SDK_API_URL': JSON.stringify(process.env.SDK_API_URL),
'process.env.LBRY_API_URL': JSON.stringify(process.env.LBRY_API_URL),
WEBPACK_PORT,
}),
],
};

View file

@ -18,9 +18,6 @@ const webConfig = {
path: __dirname + '/dist/web',
publicPath: '/',
},
devServer: {
historyApiFallback: true,
},
module: {
rules: [
{