add comments pointing to primary defintion of WEBPACK_PORT

This commit is contained in:
Sean Yesmunt 2019-05-13 22:10:41 -04:00
parent e3342eb34d
commit 467cbda5c6
3 changed files with 12 additions and 3 deletions

View file

@ -5,8 +5,8 @@ const middleware = require('webpack-dev-middleware');
const express = require('express');
const app = express();
// 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
// Primary definition for this is in webpack.web.config.js
// We can't access it here because webpack isn't running on this file
const WEBPACK_PORT = 9090;
console.log(
@ -42,7 +42,7 @@ app.use(renderInstance);
app.use(express.static('dist/electron/static'));
app.listen(WEBPACK_PORT, () => {
console.log(chalk.yellow.bold('Renderer listening on port 9090 (still compiling)'));
console.log(chalk.yellow.bold(`Renderer listening on port ${WEBPACK_PORT} (still compiling)`));
});
mainInstance.waitUntilValid(() => console.log(chalk.green(`${chalk.underline('main')} compilation complete.`)));

View file

@ -7,6 +7,10 @@
<body>
<div id="app"></div>
<!--
Primary definition for this is in webpack.web.config.js
We can't access it here because webpack isn't running on this file
-->
<script type="text/javascript" src="http://localhost:9090/ui.js"></script>
</body>
</html>

View file

@ -12,6 +12,11 @@ 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/');
// There are a two other uses of this value that can't access it from webpack
// They exist in
// src/platforms/electron/devServer.js
// static/index.dev.html
const WEBPACK_PORT = 9090;
console.log(ifProduction('production', 'development'));