apollo-client
apollo-client copied to clipboard
Apollo + Webpack : Uncaught ReferenceError: require is not defined
I am trying to add Web support to my React Native Application, but whenever I try to import from @apollo/client, i have this error in the console of my browser, and the page is blank :
Uncaught ReferenceError: require is not defined
My tsx file :
import * as client from '@apollo/client';
import React from 'react';
import {Text, View} from 'react-native';
const App = () => {
return (
<View>
<Text>Hello</Text>
</View>
);
};
export default App;
Is there something special I should do ?
Same error here
Any news on this issue, for me the minimal example crashes saying Uncaught ReferenceError: exports is not defined
+1 on this issue
Hi all 👋 Can anyone share a runnable reproduction here?
With the Metro bundler, additional configuration is required to implicitly resolve files with .cjs
/.mjs
extensions (see https://github.com/apollographql/apollo-client/issues/10719). I see Webpack is mentioned in the original issue, and I'd be happy to help resolve this with some more info. Thanks!
We're closing this issue now but feel free to ping the maintainers or open a new issue if you still need support. Thank you!
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. For general questions, we recommend using StackOverflow or our discord server.