This commit is contained in:
crusader 2018-09-27 16:57:49 +09:00
parent d34655dc32
commit 89abe15b4b
5 changed files with 32 additions and 15 deletions

View File

@ -62,7 +62,7 @@ module.exports = function () {
__PROCESS_KIND__: JSON.stringify('main'),
})
),
new ElectronConnectWebpackPlugin({
PROD ? null : new ElectronConnectWebpackPlugin({
path: root('build', 'dev'),
stopOnClose: true,
logLevel: 0

View File

@ -4,11 +4,21 @@ const util = require('util');
const webpack = require('webpack');
const { getReplacements } = require('./app-info');
const { hasProcessFlag, root } = require('./helpers.js');
const replacements = getReplacements();
const EVENT = process.env.npm_lifecycle_event || '';
const PROD = EVENT.includes('prod');
module.exports = function (config) {
config.target = 'electron-renderer';
// config.output = {
// path: PROD ? root('build', 'dist') : root('build', 'dev'),
// filename: '[name].js',
// sourceMapFilename: '[file].map',
// };
config.plugins.push(
new webpack.DefinePlugin(
@ -18,10 +28,6 @@ module.exports = function (config) {
)
);
// console.log(config.module);
// console.log(util.inspect(config.module, {showHidden: false, depth: null}));
var json = util.inspect(config, { showHidden: false, depth: null });
fse.writeFileSync('webpack.js', json, 'utf8');

View File

@ -1,7 +1,7 @@
{
"appId": "com.loafle.overflow.scanner",
"productName": "overFlow Network Scanner",
"copyright": "Copyright © 2015 LOAFLE",
"copyright": "Copyright © 2016 LOAFLE",
"directories": {
"buildResources": "electron/"
},
@ -63,6 +63,12 @@
},
"deb": {
"depends": [
"gconf2",
"gconf-service",
"libnotify4",
"libappindicator1",
"libxtst6",
"libnss3",
"libpcap"
],
"afterInstall": "config/build/linux/after-install.tpl",

View File

@ -13,6 +13,8 @@
"start:hmr": "ng serve --configuration hmr",
"start:electron:hmr": "npm-run-all -p start:hmr wait-on:build:main:dev",
"build": "ng build",
"build:renderer:dev": "ng build",
"build:renderer:prod": "ng build --aot",
"build:main:dev": "webpack --config config/webpack.config.main.js --progress --profile",
"build:main:prod": "webpack --config config/webpack.config.main.js --progress --profile",
"test": "ng test",
@ -97,4 +99,4 @@
"webpack-node-externals": "^1.7.2",
"zone.js": "^0.8.26"
}
}
}

View File

@ -175,14 +175,17 @@ export class AppWindow {
this.window.on('blur', () => this.window.webContents.send('blur'));
registerWindowStateChangedEvents(this.window);
// this.window.loadURL(encodePathAsUrl(__dirname, 'index.html'));
const indexUrl = URL.format({
pathname: path.join('//localhost:4200'),
protocol: 'http:',
slashes: true
});
this.window.loadURL(indexUrl);
if (__DEV__) {
const indexUrl = URL.format({
pathname: path.join('//localhost:4200'),
protocol: 'http:',
slashes: true
});
this.window.loadURL(indexUrl);
} else {
this.window.loadURL(encodePathAsUrl(__dirname, 'index.html'));
}
}
/**
@ -287,7 +290,7 @@ export class AppWindow {
d.showCertificateTrustDialog(
this.window,
{ certificate, message },
() => {}
() => { }
);
}