react-native-electron-platform 0.0.17 → 0.0.19

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.
Files changed (2) hide show
  1. package/package.json +11 -2
  2. package/webpack.config.mjs +11 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-electron-platform",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "A boilerplate and utilities for running React Native applications in Electron",
5
5
  "main": "index.mjs",
6
6
  "scripts": {
@@ -30,8 +30,17 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "webpack": "^5.0.0",
33
+ "webpack-cli": "^5.0.0",
34
+ "webpack-dev-server": "^4.0.0",
33
35
  "html-webpack-plugin": "^5.0.0",
34
- "webpack-cli": "^5.0.0"
36
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.0",
37
+ "@babel/core": "^7.0.0",
38
+ "@babel/preset-env": "^7.0.0",
39
+ "@babel/preset-react": "^7.0.0",
40
+ "@babel/preset-typescript": "^7.0.0",
41
+ "babel-loader": "^9.0.0",
42
+ "react-refresh": "^0.14.0",
43
+ "file-loader": "^6.0.0"
35
44
  },
36
45
  "peerDependencies": {
37
46
  "react-native": ">=0.60.0"
@@ -2,6 +2,7 @@ import path from 'path';
2
2
  import { fileURLToPath } from 'url';
3
3
  import { dirname } from 'path';
4
4
  import HtmlWebpackPlugin from 'html-webpack-plugin';
5
+ import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
5
6
  import fs from 'fs';
6
7
  import packageJson from '../../package.json' with { type: 'json' };
7
8
  import { generateAlias, generateFallback } from './src/webpackConfigHelper.mjs';
@@ -19,6 +20,12 @@ class CopyFontsPlugin {
19
20
  fs.mkdirSync(destDir, { recursive: true });
20
21
  }
21
22
 
23
+ // Add fallback check for missing source directory
24
+ if (!fs.existsSync(sourceDir)) {
25
+ console.warn(`[CopyFontsPlugin] Warning: Fonts directory not found at ${sourceDir}. Skipping font copy.`);
26
+ return;
27
+ }
28
+
22
29
  const files = fs.readdirSync(sourceDir);
23
30
  files.forEach(file => {
24
31
  const source = path.join(sourceDir, file);
@@ -71,17 +78,7 @@ export default {
71
78
  use: {
72
79
  loader: 'babel-loader',
73
80
  options: {
74
- presets: [
75
- '@babel/preset-env',
76
- '@babel/preset-react',
77
- '@babel/preset-typescript',
78
- ],
79
- plugins: [
80
- ['@babel/plugin-transform-class-properties', { loose: true }],
81
- ['@babel/plugin-transform-private-methods', { loose: true }],
82
- ['@babel/plugin-transform-private-property-in-object', { loose: true }],
83
- '@babel/plugin-transform-runtime',
84
- ],
81
+ plugins: ['react-refresh/babel'],
85
82
  },
86
83
  },
87
84
  },
@@ -93,16 +90,7 @@ export default {
93
90
  use: {
94
91
  loader: 'babel-loader',
95
92
  options: {
96
- presets: [
97
- '@babel/preset-env',
98
- '@babel/preset-react',
99
- '@babel/preset-typescript',
100
- ],
101
- plugins: [
102
- ['@babel/plugin-transform-class-properties', { loose: true }],
103
- ['@babel/plugin-transform-private-methods', { loose: true }],
104
- ['@babel/plugin-transform-private-property-in-object', { loose: true }],
105
- ],
93
+ plugins: ['react-refresh/babel'],
106
94
  },
107
95
  },
108
96
  },
@@ -141,6 +129,7 @@ export default {
141
129
  },
142
130
 
143
131
  plugins: [
132
+ new ReactRefreshWebpackPlugin(),
144
133
  new CopyFontsPlugin(),
145
134
  new HtmlWebpackPlugin({
146
135
  template: path.resolve(__dirname, 'src/index.html'),
@@ -156,4 +145,4 @@ export default {
156
145
  maxEntrypointSize: 512000,
157
146
  maxAssetSize: 512000,
158
147
  },
159
- };
148
+ };