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'), __PROCESS_KIND__: JSON.stringify('main'),
}) })
), ),
new ElectronConnectWebpackPlugin({ PROD ? null : new ElectronConnectWebpackPlugin({
path: root('build', 'dev'), path: root('build', 'dev'),
stopOnClose: true, stopOnClose: true,
logLevel: 0 logLevel: 0

View File

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

View File

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

View File

@ -13,6 +13,8 @@
"start:hmr": "ng serve --configuration hmr", "start:hmr": "ng serve --configuration hmr",
"start:electron:hmr": "npm-run-all -p start:hmr wait-on:build:main:dev", "start:electron:hmr": "npm-run-all -p start:hmr wait-on:build:main:dev",
"build": "ng build", "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:dev": "webpack --config config/webpack.config.main.js --progress --profile",
"build:main:prod": "webpack --config config/webpack.config.main.js --progress --profile", "build:main:prod": "webpack --config config/webpack.config.main.js --progress --profile",
"test": "ng test", "test": "ng test",

View File

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