about summary refs log tree commit diff
path: root/patches/metro-transform-worker+0.80.1.patch
blob: 65f44e578306e532271bf7af9c3ab9e8623780df (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
diff --git a/node_modules/metro-transform-worker/src/index.js b/node_modules/metro-transform-worker/src/index.js
index cae11e7..42f251b 100644
--- a/node_modules/metro-transform-worker/src/index.js
+++ b/node_modules/metro-transform-worker/src/index.js
@@ -189,6 +189,10 @@ async function transformJS(file, { config, options, projectRoot }) {
   let dependencyMapName = "";
   let dependencies;
   let wrappedAst;
+  const minify =
+    options.minify &&
+    options.unstable_transformProfile !== "hermes-canary" &&
+    options.unstable_transformProfile !== "hermes-stable";
 
   // If the module to transform is a script (meaning that is not part of the
   // dependency graph and it code will just be prepended to the bundle modules),
@@ -228,19 +232,20 @@ async function transformJS(file, { config, options, projectRoot }) {
     if (config.unstable_disableModuleWrapping === true) {
       wrappedAst = ast;
     } else {
+      let moduleFactoryName;
+      if (options.dev && !minify) {
+        moduleFactoryName = file.filename;
+      }
       ({ ast: wrappedAst } = JsFileWrapping.wrapModule(
         ast,
         importDefault,
         importAll,
         dependencyMapName,
-        config.globalPrefix
+        config.globalPrefix,
+        moduleFactoryName
       ));
     }
   }
-  const minify =
-    options.minify &&
-    options.unstable_transformProfile !== "hermes-canary" &&
-    options.unstable_transformProfile !== "hermes-stable";
   const reserved = [];
   if (config.unstable_dependencyMapReservedName != null) {
     reserved.push(config.unstable_dependencyMapReservedName);