-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
Describe the bug
Using socket.io-client in react native causes a build error
Web Bundling failed 5906ms
Unable to resolve "@socket.io/component-emitter" from "node_modules/socket.io-client/build/esm/manager.js"To Reproduce
Please fill the following code example:
Socket.io-client version: ^4.7.2
Client
import io from "socket.io-client";
...Expected behavior
To resolve Socket.io-client library modules
Platform:
- React Native: 0.72.6
- Metro bundler: 0.76.8
- Expo: ~49.0.15
- OS: [e.g. Mac OS 9.2]
Additional context
I did find a work around via the metro bundler config using the following
const { getDefaultConfig } = require('expo/metro-config');
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname, {
...
});
module.exports = (async () => {
// add support to implicitly resolve modules with .(c|m)js extensions
config.resolver.sourceExts.push('cjs');
config.resolver.sourceExts.push('mjs');
return config;
})();Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation