Make production build work, for the most part
This commit is contained in:
parent
e6c3b5f9ea
commit
63e07cd42f
@ -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",
|
||||
|
15
public/index-prod.html
Normal file
15
public/index-prod.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||
<link rel="shortcut icon" href="./favicon.ico"/>
|
||||
<link rel="stylesheet" href="./css/bootstrap.css"/>
|
||||
<link rel="stylesheet" href="./css/app.css"/>
|
||||
<title>Inferno App</title>
|
||||
</head>
|
||||
<body>
|
||||
<film-exif id="app"></film-exif>
|
||||
<script src="./bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -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(),
|
||||
],
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
Loading…
Reference in New Issue
Block a user