metro icon indicating copy to clipboard operation
metro copied to clipboard

Metro bundler breaks socket.io (from 0.57.4 till 0.59rc) - unable to connect.

Open csotiriou opened this issue 5 years ago • 5 comments

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Metro bundler seems to package latest versions of socket.io in such a way that it breaks completely. Even on a very simple application with a basic socket.io server enabled, the client will be unable to connect. This issue is present on both iOS and Android, all versions. It started since React Native 0.57.4. RN 0.57.3 worked fine.

Other issue: https://github.com/facebook/react-native/issues/22043

The reason I am suspecting the Metro bundler is at fault, is that I switched to Haul as my bundler (https://github.com/callstack/haul) and the problem disappeared completely from all versions I tried (version 0.57.x till 0.59.rc).

In the linked issue people say that switching to an older version of Socket.io seems to solve the issue. Haven't been able to reproduce this yet.

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.

Install latest version of React Native (0.59RC, 0.58, or 0.57.4 and later), install socket.io, configure it to connect to a socket.io server (any server) and run.

What is the expected behavior?

The socket.io would be able to connect to a socket.io enabled server.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.

  • Default Metro configuration
  • yarn 1.12.3
  • iOS 11 & Android 5+. Both Xcode and Android Studio.
  • React Native 0.57.4 and above, 0.58.x, 0.59

csotiriou avatar Mar 02 '19 12:03 csotiriou