diff --git a/package.json b/package.json
index 42a5ed2..8049f1f 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,9 @@
"build/**/*",
"node_modules/**/*"
],
+ "directories": {
+ "buildResources": "assets"
+ },
"mac": {
"category": "public.app-category.photography",
"icon": "assets/icons/FilmExif.icns",
@@ -80,7 +83,8 @@
},
"scripts": {
"build": "set NODE_ENV=production && rollup --config rollup.prod.js",
- "dist": "yarn run build && build",
+ "predist": "yarn run build",
+ "dist": "build",
"electron-start": "set NODE_ENV=development && node src/electron/wait-inferno",
"electron": "electron .",
"fix": "eslint --fix src/**/*.js",
diff --git a/public/index-prod.html b/public/index-prod.html
new file mode 100644
index 0000000..2ffbf30
--- /dev/null
+++ b/public/index-prod.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+ Inferno App
+
+
+
+
+
+
diff --git a/rollup.prod.js b/rollup.prod.js
index 4dda7c6..367fe4d 100644
--- a/rollup.prod.js
+++ b/rollup.prod.js
@@ -2,6 +2,7 @@ import baseConfig from './rollup.config';
import filesize from 'rollup-plugin-filesize';
import replace from 'rollup-plugin-replace';
import { terser } from 'rollup-plugin-terser';
+import copy from 'rollup-plugin-copy';
export default {
...baseConfig,
@@ -10,6 +11,12 @@ export default {
'process.env.NODE_ENV': "'production'",
}),
...baseConfig.plugins,
+ copy({
+ 'public/index-prod.html': 'build/index.html',
+ 'public/favicon.ico': 'build/favicon.ico',
+ 'public/css/bootstrap.css': 'build/css/bootstrap.css',
+ 'public/css/app.css': 'build/css/app.css',
+ }),
terser(),
filesize(),
],
diff --git a/src/electron/app.js b/src/electron/app.js
index 212e391..9b858ec 100644
--- a/src/electron/app.js
+++ b/src/electron/app.js
@@ -1,8 +1,6 @@
import {app, BrowserWindow} from 'electron';
-import installExtension, { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer';
import log from 'electron-log';
import path from 'path';
-import url from 'url';
log.transports.file.level = false;
log.transports.console.level = 'info';
@@ -15,34 +13,24 @@ let mainWindow;
const createWindow = () => {
// Create the browser window.
- if (DEV_MODE) {
- mainWindow = new BrowserWindow();
- } else {
- mainWindow = new BrowserWindow({
- webPreferences: {
- contextIsolation: true,
- nodeIntegration: false,
- },
- });
- }
+ mainWindow = new BrowserWindow({
+ webPreferences: {
+ contextIsolation: true,
+ nodeIntegration: false,
+ },
+ });
// Open the DevTools.
if (DEV_MODE) {
- installExtension(REACT_DEVELOPER_TOOLS)
- .then((extensionName) => console.log(`Added Extension: ${extensionName}`))
- .catch((err) => console.log('An error occurred: ', err));
-
mainWindow.webContents.openDevTools({
mode: 'bottom',
});
}
// load the index.html of the app.
- const startUrl = process.env.ELECTRON_START_URL || url.format({
- pathname: path.join(__dirname, '/../../build/index.html'),
- protocol: 'file:',
- slashes: true,
- });
+ const startUrl = DEV_MODE
+ ? 'http://localhost:3000'
+ : `file://${path.join(__dirname, '/../../build/index.html')}`;
mainWindow.loadURL(startUrl);
// Emitted when the window is closed.