Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RN 0.57 breaks with advanced compilation #203

Open
vikeri opened this issue Nov 22, 2018 · 2 comments
Open

RN 0.57 breaks with advanced compilation #203

vikeri opened this issue Nov 22, 2018 · 2 comments

Comments

@vikeri
Copy link

vikeri commented Nov 22, 2018

I had some trouble with RN 0.57.5, got the following error: Can't find variable a.

After looking around I solved it by patching the metro bundler in node_modules:

metro/src/JSTransformer/worker.js

--- worker.js	2018-11-21 14:46:01.271844624 -0700
+++ worker.js	2018-11-21 14:45:52.517615272 -0700
@@ -199,10 +199,10 @@
         plugins.push([inlineRequiresPlugin, opts]);
       }
 
-      if (!options.dev) {
-        plugins.push([constantFoldingPlugin, opts]);
-        plugins.push([inlinePlugin, opts]);
-      }
+      // if (!options.dev) {
+      // plugins.push([constantFoldingPlugin, opts]);
+      plugins.push([inlinePlugin, opts]);
+      // }
       var _transformFromAstSync = transformFromAstSync(ast, "", {
         ast: true,
         babelrc: false,

Apply the code above with patch node_modules/metro/src/JSTransformer/worker.js ./<savethesnippetabove>.patch

@vikeri
Copy link
Author

vikeri commented Nov 22, 2018

Tracking the upstream issue here: facebook/metro#317

@chpill
Copy link

chpill commented Nov 23, 2018

Note that constant folding only breaks the file produced by advanced compilation. You only need to tell the worker to avoid that particular file.

More detail in the issue on metro I reported a few weeks ago facebook/metro#291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants