@codemoreira/esad 2.0.1-24 → 2.0.1-25

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": "@codemoreira/esad",
3
- "version": "2.0.1-24",
3
+ "version": "2.0.1-25",
4
4
  "description": "Easy Super App Development - Zero-Config CLI and DevTools for React Native Module Federation",
5
5
  "main": "src/plugin/index.js",
6
6
  "types": "./src/plugin/index.d.ts",
@@ -2,7 +2,7 @@ const path = require('node:path');
2
2
  const fs = require('node:fs');
3
3
  const Repack = require('@callstack/repack');
4
4
  const { ExpoModulesPlugin } = require('@callstack/repack-plugin-expo-modules');
5
- const { DefinePlugin } = require('@rspack/core');
5
+ const { DefinePlugin, BannerPlugin } = require('@rspack/core');
6
6
 
7
7
  /**
8
8
  * ESAD Re.Pack Plugin Wrapper
@@ -116,6 +116,16 @@ function withESAD(env, options) {
116
116
  }),
117
117
  '__DEV__': JSON.stringify(isDev),
118
118
  }),
119
+ new BannerPlugin({
120
+ raw: true,
121
+ entryOnly: true,
122
+ banner: `
123
+ if (typeof process === 'undefined') { var process = { env: {} }; }
124
+ if (typeof process.env === 'undefined') { process.env = {}; }
125
+ process.env.EXPO_OS = '${platform}';
126
+ process.env.NODE_ENV = '${isDev ? 'development' : 'production'}';
127
+ `,
128
+ }),
119
129
  new ExpoModulesPlugin(),
120
130
  new Repack.RepackPlugin(),
121
131
  new Repack.plugins.ModuleFederationPluginV2({
@@ -0,0 +1,15 @@
1
+ /**
2
+ * ESAD Runtime Environment Polyfill
3
+ * This file is injected at the very beginning of the bundle to ensure
4
+ * that Expo and React Navigation find the expected environment variables.
5
+ */
6
+ if (typeof global !== 'undefined') {
7
+ global.process = global.process || {};
8
+ global.process.env = global.process.env || {};
9
+
10
+ // These values are placeholders that will be replaced by DefinePlugin
11
+ // or set via BannerPlugin, but here we provide a safe fallback object.
12
+ if (typeof global.process.env !== 'object' || global.process.env === null) {
13
+ global.process.env = {};
14
+ }
15
+ }