-
Notifications
You must be signed in to change notification settings - Fork 626
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
Exclude $projectRoot/package.json
from assets
#420
Conversation
Codecov Report
@@ Coverage Diff @@
## master #420 +/- ##
=======================================
Coverage 83.21% 83.21%
=======================================
Files 181 181
Lines 6089 6089
Branches 964 964
=======================================
Hits 5067 5067
Misses 891 891
Partials 131 131
Continue to review full report at Codecov.
|
please merge! |
Temporary fix while we wait for this to be merged. Add this script to the root project directory and run it
Then, inside your inside your
The script applies the changes from this PR. |
@IgorBelyayev love it ahaha |
disculpa, cual seria la raiz de mi proyecto??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, wrong button.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@cpojer this commit does not seem to be included in the latest release (0.56.0)'s npm package. Can you please take a look into this? Thanks! |
I'm also on 0.56.0 and still seeing this issue. Any updates? |
@robertying, I had to update to RN 0.61.x in order to pick up this change, if that helps. |
@cdunkel thanks! I think 0.61 now includes this patch. |
Summary
From dcb41e3#diff-235a3e5d21175615e1cc254dd8b17eb2, files with
json
extension will be considered as assets and returned asoutputAssets
for@react-native-community/cli
.This means
cli
will copy files withjson
extension to resource dir, in Android's case,android/app/build/res
.Here comes a problem. If
package.json
at the project root gets copied, it won't be renamed as otherpackage.json
innode_modules
(e.g.raw/node_modules_reactnativecodepush_package.json
). Instead, it will reside inres
aspackage.json
, which causes the error:facebook/react-native#25325
This regression (I believe ;)) was introduced to React Native 0.60.0-rc with metro bumping from 0.51 to 0.54.
Possible impact
Typical usage concerning
package.json
at the root will be something likeimport packageJson from "./package.json"
in JS files to get some project configurations and those content will be bundled intoindex.android.bundle
no matter what. So removing$projectRoot/package.json
won't have too much impact.This new (or bad?) behavior has only been in React Native 0.60-rc so it won't affect current projects running 0.59. It should be fixed before the final release of 0.60, I assume.
Test plan
react-native init resoucesRepro --version react-native@next
(so it uses 0.60.0-rc)import packageJson from './package.json'
toApp.js
.cd android && ./gradlew assembleRelease
node_modules/metro/src/DeltaBundler/Serializers/getAssets.js
to match this commit.cd android && ./gradlew assembleRelease