@codemoreira/esad 1.4.6-11 → 1.4.6-13

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 +1 -1
  2. package/src/plugin/index.js +21 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemoreira/esad",
3
- "version": "1.4.6-11",
3
+ "version": "1.4.6-13",
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",
@@ -36,10 +36,30 @@ function withESAD(env, options) {
36
36
  output: {
37
37
  path: path.resolve(dirname, 'build', platform),
38
38
  filename: 'index.bundle',
39
- clean: true,
39
+ chunkFilename: '[name].chunk.bundle',
40
40
  },
41
+ ...((options.type === 'host' && dev !== false) ? {
42
+ devServer: {
43
+ hot: true,
44
+ port: 8081,
45
+ historyApiFallback: true,
46
+ setupMiddlewares: (middlewares) => {
47
+ middlewares.unshift((req, res, next) => {
48
+ if (req.url.startsWith('/.expo/.virtual-metro-entry')) {
49
+ const query = req.url.split('?')[1];
50
+ const target = '/index.bundle';
51
+ req.url = query ? `${target}?${query}` : target;
52
+ console.log(`[ESAD] Routing virtual entry to: ${req.url}`);
53
+ }
54
+ next();
55
+ });
56
+ return middlewares;
57
+ },
58
+ },
59
+ } : {}),
41
60
  resolve: {
42
61
  ...Repack.getResolveOptions(platform),
62
+ fullySpecified: false,
43
63
  alias: {
44
64
  '~': dirname,
45
65
  '@': dirname,
@@ -58,9 +78,6 @@ function withESAD(env, options) {
58
78
  path.resolve(dirname, 'index.js'),
59
79
  /[\\/]node_modules[\\/](expo-router|react-native|@react-native|expo-modules-core|@module-federation|@react-navigation)[\\/]/
60
80
  ],
61
- resolve: {
62
- fullySpecified: false,
63
- }
64
81
  },
65
82
  ...Repack.getJsTransformRules(),
66
83
  ...Repack.getAssetTransformRules(),
@@ -110,17 +127,6 @@ function withESAD(env, options) {
110
127
  ],
111
128
  };
112
129
 
113
- if (options.type === 'host') {
114
- config.devServer = {
115
- proxy: [
116
- {
117
- context: ['/.expo/.virtual-metro-entry'],
118
- pathRewrite: { '^/.expo/.virtual-metro-entry': '/index' },
119
- },
120
- ],
121
- };
122
- }
123
-
124
130
  return config;
125
131
  }
126
132