pull/3/head
caorushizi 4 years ago
parent 44818dcd86
commit eaa0e4e845

@ -5,7 +5,20 @@ const webpack = require("webpack");
const path = require("path");
loadEnv();
const binPathString = path.resolve(__dirname, "../.bin").replace(/\\/g, "\\\\");
const plugins = [
new ESLintPlugin({
exclude: "node_modules",
}),
];
if (process.env.NODE_ENV === "development") {
plugins.push(
new webpack.DefinePlugin({
__bin__: `"${path.resolve(__dirname, "../.bin").replace(/\\/g, "\\\\")}"`,
})
);
}
module.exports = {
entry: "./src/main/index.js",
@ -19,14 +32,7 @@ module.exports = {
},
],
},
plugins: [
new ESLintPlugin({
exclude: "node_modules",
}),
new webpack.DefinePlugin({
__bin__: `"${binPathString}"`,
}),
],
plugins,
resolve: {
extensions: [".js", ".jsx", ".css"],
},

@ -1,3 +1,5 @@
chcp 65001
rd /S /Q "./.bin/Logs"
npx cross-env NODE_ENV=production electron-forge make

@ -1,5 +1,6 @@
import { app, BrowserView, BrowserWindow, ipcMain, session } from "electron";
import { is } from "electron-util";
import path from "path";
import store from "./store";
import { exec, failFn, successFn } from "./utils";
import logger from "./logger";
@ -9,6 +10,13 @@ if (require("electron-squirrel-startup")) {
app.quit();
}
if (!is.development) {
// eslint-disable-next-line no-underscore-dangle
global.__bin__ = path
.resolve(app.getAppPath(), "../.bin")
.replace(/\\/g, "\\\\");
}
const createMainWindow = async () => {
const mainWindow = new BrowserWindow({
width: 800,

Loading…
Cancel
Save