haul icon indicating copy to clipboard operation
haul copied to clipboard

release build is not working

Open lavaxun opened this issue 7 years ago • 8 comments

Current Behavior

I'm currently facing some issue with the latest haul & react native in RELEASE BUILD. Please find the attached to understand the issue better.

I followed through the documentation and I managed to run the application in DEBUG BUILD. You can reproduce the issue here: https://github.com/lavaxun/haul-issue.

HOWEVER it's not working well in the release build. I changed the 'scheme' in xcode to be using 'Release' and clicked the 'Run'. Screenshot below shows the error. As you can see the build phase is using CLI_PATH. And it's giving a long list of errors when executing the bundling script during the build phase. (but the app can still be started despite of the build errors) When I try to use 'fetch' to perform HTTP POST. it shows me 'unsupported bodyinit type' error.

not-working-with-cli_path

Another screenshot below shows the bundling script is working fine in the build phase. but without specifying CLI_PATH. And there is no problem in using 'fetch' to do HTTP POST.

working-without-cli_path

Expected Behavior

The RELEASE build should be executed without errors. It should work just like the second screenshot above but with CLI_PATH.

Haul Configuration (haul.config.js)

import { createWebpackConfig } from "haul";

export default {
  webpack: createWebpackConfig(({ platform }) => ({
    entry: `./index.js`
  }))
};

Your Environment

software version
Haul 1.0.0-rc.9
react-native 0.57.2
react-native-navigation 1.1.491
node 8.11.4
yarn 1.10.1

lavaxun avatar Oct 22 '18 10:10 lavaxun

+1

Summys avatar Oct 24 '18 05:10 Summys

Hi, I'm facing the same issue as well with the latest React Native version and Haul on Android. I'm able to run release build but I get this unsupported BodyInit type error while debug mode is working properly.

screenshot 2018-10-29 at 9 40 00 am

jeffreycgy avatar Oct 29 '18 01:10 jeffreycgy

+1

louiskhenghao avatar Oct 29 '18 08:10 louiskhenghao

Would be great if somebody created a repo with a repro and investigate.

thymikee avatar Oct 29 '18 08:10 thymikee

@thymikee I have made a repo here https://github.com/lavaxun/haul-issue. would be great if someone can help to investigate it.

lavaxun avatar Oct 31 '18 06:10 lavaxun

do you have any idea on the issue after the initial investigation?

lavaxun avatar Nov 13 '18 01:11 lavaxun

Did some quick hacks and managed to fix the issue here! https://github.com/lavaxun/haul/commit/f112dc0b832242856d2d65d20beb30b231fd971b

Hope someone can send a proper PR to fix this issue.

Context: I suspect this has got to do with polyfill and hence started to zoom down to the src/utils/polyfillEnvironment.js.

Then I figured out there was a previous issue on the global fetch at https://github.com/callstack/haul/issues/146 And there is a PR https://github.com/callstack/haul/pull/74 addresses this problem.

lavaxun avatar Nov 13 '18 14:11 lavaxun

I have made a PR https://github.com/callstack/haul/pull/494 to fix the issue by using webpack banner in production environment.

lavaxun avatar Nov 13 '18 15:11 lavaxun