For path reference between the development process and the deployment process, the path to my static resource was specified using environmental variables.
First, in electron/package.json
"main": "./src-gen/backend/electron-main-router.js"
electron-main-router.js
// @ts-check
const path = require('path');
const { app } = require('electron');
const userHome = require('user-home');
let mainModulePath;
if (app.isPackaged) {
mainModulePath = path.join(__dirname, '../../lib/backend/electron-main.js');
process.env.RESOURCES_PATH = path.join(__dirname, '../../lib/resources')
} else {
mainModulePath = path.join(__dirname, 'electron-main.js');
process.env.RESOURCES_PATH = path.join(__dirname, '../../../myProject/src/resources')
}
require(mainModulePath);
I tried to use this in Lander’s process.
But
ReferenceError: process is not defined
How do you solve it?