`haul init` clobbers existing project.ext.react gradle config
See original GitHub issueCurrent Behavior
haul init adds the following block to my project’s android/app/build.gradle above the react.gradle import, which overwrites my existing project.ext.react assignment.
project.ext.react = [
cliPath: "node_modules/haul/bin/cli.js"
]
Expected Behavior
haul init should merge the new cliPath property into project.ext.react config if it exists, or fall back to the current behavior and create a new project.ext.react block.
Haul Configuration (webpack.haul.js)
module.exports = () => ({
entry: `./index.js`,
});
Your Environment
| software | version |
|---|---|
| Haul | 1.0.0-beta.13 |
| react-native | 0.53.0 |
| node | v9.3.0 |
| npm or yarn | v1.3.2 |
Workaround is just to manually merge the two project.ext.react blocks, but it’d be nice if haul init did this for you.
It looks like it just needs a bit more logic where it adds this block here
I’m happy to PR a fix in the coming week : )
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:5 (5 by maintainers)
Top Results From Across the Web
haul/Configuring_Your_Project.md at master - GitHub
Haul is a command line tool for developing React Native apps, ... run the following to automatically configure your gradle config to use...
Read more >Getting Started · Haul
Start by adding Haul as a dependency to your React Native project (use react-native init MyProject to create one if you don't have...
Read more >0 - Stack Overflow
to my android/app/build.gradle file and generated the following wepack.haul.js file. const path = require("path ...
Read more >Bundling React Native during Android release builds
gradle file, we were able to hook into the bundling command on all our release builds. Our config: // Configures the bundleJS commands...
Read more >Config variables for React Native apps - npm
Setup · android/settings.gradle include ':react-native-config' + project(':react-native-config').projectDir = new File(rootProject.projectDir, ' ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

If that helps the case, but we can also search for existing
project.ext.reactand bailout with a proper warning to the userI think we can get away with not doing anything clever string-wise (especially since we’d have to deal with comments and multiple possible locations where
project.ext.reactis manipulated). Since we’re doing the replacing right about thereact.gradleimport and I think we can be reasonably sure this is the furthest down in the config that the user would assign their ownext.reactvalues, how about just swapping out the snippet with a graceful initialization ofext.reactand then a more surgicalcliPathassignment? We’d end up with giving the user the following: