Skip to content

React Native Packager Compatibility Tip#750

Open
MikeShi42 wants to merge 1 commit intorethinkdb:nextfrom
MikeShi42:next
Open

React Native Packager Compatibility Tip#750
MikeShi42 wants to merge 1 commit intorethinkdb:nextfrom
MikeShi42:next

Conversation

@MikeShi42
Copy link
Copy Markdown

@MikeShi42 MikeShi42 commented Aug 15, 2016

Relevant to client 2.0.0-beta-4

Right now Horizon client is broken for React Native straight out of the box (through NPM). React Native tries to package all of a project's dependencies with its own packager. The packager checks all packages for babel configs and will try to use the package's babel config to pack the files properly. However, something seems to be wrong with it trying to use es2015-loose. The best workaround I found so far is to just remove the babel configs so that way React Native will try to package it with its own default settings (which works out well). I'm submitting this PR so that anyone else trying to work with RN on horizon v2 beta can at least start experimenting.

It's extremely hacky, if there's something is in the works to fix this permanently that would be great. Would also be awesome if someone else could validate this indeed fixes it and isn't some weird coincidence. Perhaps it would be also good to note that the current stable is not compatible with RN.


This change is Reviewable

The issue is most likely how the packager resolves dependencies as the nested babel dependency isn't used. It's odd behavior that is hard to track down the root issue but this workaround seems to be pretty good for now.
@benjick
Copy link
Copy Markdown

benjick commented Aug 27, 2016

FWIW I'm using this under scripts.postinstall

// Remove babel dependencies from horizon to make React Native happy

const fs = require('fs');

const filename = 'node_modules/@horizon/client/package.json';
const fileContent = fs.readFileSync(filename);
const json = JSON.parse(fileContent);
delete json.babel;
fs.writeFileSync(filename, JSON.stringify(json, null, 2));

@radiegtya
Copy link
Copy Markdown

@benjick : where did you write those script??

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

Successfully merging this pull request may close these issues.

4 participants