callstack / repack

A Webpack-based toolkit to build your React Native application with full support of Webpack ecosystem.
https://re-pack.dev
MIT License
1.48k stars 110 forks source link

apk release with warning Disconnected from the dev Server #708

Closed eeuruetade closed 3 months ago

eeuruetade commented 3 months ago

Describe the bug

Hello, I am generating an apk release and when it is installed it throws me the following message

Disconnected from the dev Server: undefined

image

When I generate it, the console shows me the following:

? [21:37:51.933Z][webpack.DefinePlugin] Replaced "__DEV__" with "true"
? [21:37:51.935Z][webpack.DefinePlugin] Replaced "__DEV__" with "true"
? [21:37:51.940Z][webpack.DefinePlugin] Replaced "process.env.NODE_ENV" with ""development""
? [21:37:51.959Z][webpack.DefinePlugin] Replaced "process.env.NODE_ENV" with ""development""

My build scripts:

"build:aab": "react-native build-android --mode=release",
"build:android": "cd android && ./gradlew assembleRelease",
"bundle": "yarn bundle:ios && yarn bundle:android",
"bundle:ios": "react-native webpack-bundle --platform ios --entry-file index.js --dev false ",
"bundle:android": "react-native webpack-bundle --platform android --entry-file index.js --dev false"

My package.json

 "dependencies": {
    "@react-native-masked-view/masked-view": "^0.3.1",
    "@react-navigation/bottom-tabs": "^6.6.1",
    "@react-navigation/native": "^6.1.18",
    "@react-navigation/native-stack": "^6.11.0",
    "react": "18.2.0",
    "react-native": "0.74.5",
    "react-native-gesture-handler": "^2.18.1",
    "react-native-safe-area-context": "^4.10.9",
    "react-native-screens": "^3.34.0",
    "redaxios": "^0.5.1"
  },

I can't find what configuration to make it correctly take the apk release as production.

System Info

System:
  OS: macOS 14.6.1
  CPU: (12) arm64 Apple M3 Pro
  Memory: 107.59 MB / 18.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.5.1
    path: /opt/homebrew/bin/node
  Yarn:
    version: 3.6.4
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.2
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.07.15.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK:
    API Levels:
      - "34"
      - "35"
    Build Tools:
      - 34.0.0
      - 35.0.0
    System Images:
      - android-34 | Google APIs ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2411.12071903
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.5
    wanted: 0.74.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Re.Pack Version

4.2.0

Reproduction

https://github.com/eeuruetade/host-rickandmorty

Steps to reproduce

Run

yarn install 
yarn build
yarn build:android
jbroma commented 3 months ago

hi @eeuruetade,

the issues you are having is caused by --dev false not being parsed correctly when building the bundle so when building for release you ended up with development bundle.

This was fixed in https://github.com/callstack/repack/pull/697 and will be released on monday, as part of 4.3.0.

I'll close this, since it's a duplicate of #695