next-with-apollo
next-with-apollo copied to clipboard
SSR is working on development but not working after build
Hi, i have problem like below
_app.js
import { getDataFromTree } from "@apollo/client/react/ssr";
function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />;
}
export default withApollo(MyApp, { getDataFromTree });
hoc/withApollo.js
export default withApollo(
({ initialState, headers }) => {
return new ApolloClient({
headers,
credentials: "same-origin",
uri: `${API_URI}/graphql`,
cache: new InMemoryCache().restore(initialState || {}),
});
},
{
render: ({ Page, props }) => {
return (
<ApolloProvider client={props.apollo}>
<Page {...props} />
</ApolloProvider>
);
},
}
);