react-native-electron-platform 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-electron-platform",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "A boilerplate and utilities for running React Native applications in Electron",
5
5
  "main": "index.mjs",
6
6
  "scripts": {
@@ -2,6 +2,7 @@ import { BrowserWindow, screen, session } from "electron";
2
2
  import path from "path";
3
3
  import fs from "fs";
4
4
  import { app, dialog } from "electron";
5
+ import { ApiUrl } from "react-native-electron-platform/webpack.config.mjs";
5
6
 
6
7
  export function createMainWindow(__dirname) {
7
8
  const primaryDisplay = screen.getPrimaryDisplay();
@@ -23,7 +24,7 @@ export function createMainWindow(__dirname) {
23
24
  nodeIntegration: false,
24
25
  contextIsolation: true,
25
26
  sandbox: false,
26
- webSecurity: false,
27
+ webSecurity: true,
27
28
  disableBlinkFeatures: "AutoLoadIconsForPage",
28
29
  nativeWindowOpen: true,
29
30
  spellcheck: true,
@@ -90,8 +91,8 @@ function loadAppContent(mainWindow, __dirname) {
90
91
  const isDev = isDevMode();
91
92
 
92
93
  if (isDev) {
93
- mainWindow.loadURL("http://localhost:5001");
94
- console.log("DEV MODE: http://localhost:5001");
94
+ mainWindow.loadURL(ApiUrl);
95
+ console.log("DEV MODE:", ApiUrl);
95
96
  } else {
96
97
  const possiblePaths = [
97
98
  path.join(__dirname, "web-build/index.html"),
@@ -8,6 +8,9 @@ import packageJson from '../../package.json' with { type: 'json' };
8
8
  import { generateAlias, generateFallback } from './src/webpackConfigHelper.mjs';
9
9
 
10
10
  const __dirname = dirname(fileURLToPath(import.meta.url));
11
+ const port = process.env.PORT || 5001;
12
+ const host = process.env.HOST || 'localhost';
13
+ export const ApiUrl = `http://${host}:${port}`;
11
14
 
12
15
  // Plugin to copy vector icon fonts
13
16
  class CopyFontsPlugin {
@@ -42,8 +45,8 @@ export default {
42
45
  devtool: 'source-map',
43
46
 
44
47
  devServer: {
45
- port: 5001,
46
- host: 'localhost',
48
+ port: port,
49
+ host: host,
47
50
  hot: true,
48
51
  compress: true,
49
52
  historyApiFallback: true,