Fix dev mode

This commit is contained in:
Shawn 2019-03-15 14:37:51 -05:00
parent e932e1ed43
commit 39040adb45
3 changed files with 20 additions and 7 deletions

View file

@ -46,6 +46,7 @@ const renderInstance = middleware(renderCompiler, {
});
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)'));
@ -64,7 +65,7 @@ mainInstance.waitUntilValid(() => {
const electron = require('electron');
const proc = require('child_process');
const child = proc.spawn(electron, ['./dist/electron/main.js']);
const child = proc.spawn(electron, ['./dist/electron/webpack/main.js']);
child.stdout.on('data', (data) => {
console.log(data.toString());

View file

@ -7,7 +7,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
const STATIC_ROOT = path.resolve(__dirname, 'static/');
const DIST_ROOT = path.resolve(__dirname, 'dist/');
const mainConfig = {
let mainConfig = {
target: 'electron-main',
entry: {
main: './src/platforms/electron/index.js',
@ -46,10 +46,22 @@ const mainConfig = {
devServer: {
contentBase: path.join(__dirname, 'dist/electron'),
},
};
if (process.env.NODE_ENV === 'production') {
// Apply prod overrides
mainConfig = merge(mainConfig, {
externals: {
keytar: 'require("keytar")',
},
};
});
} else {
const nodeExternals = require('webpack-node-externals');
// Apply dev overrides
mainConfig = merge(mainConfig, {
externals: [nodeExternals()],
});
}
const renderConfig = {
target: 'electron-renderer',

View file

@ -6038,9 +6038,9 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
tar-stream "^1.6.2"
zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#c2c85a49674662724c943c83afb6141bb41019b7:
lbry-redux@lbryio/lbry-redux#2a7e05940f892f104428eeb37bd1f178da811a09:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/c2c85a49674662724c943c83afb6141bb41019b7"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/2a7e05940f892f104428eeb37bd1f178da811a09"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"