You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HI!
I'm creating a library to wrap some precofigured hooks/funcs for my application.
Building it using vite I have this error while trying to import registerApolloClient:
RollupError: src/client/ssr.ts (2:9): "registerApolloClient" is not exported by "node_modules/.pnpm/@apollo+experimental-nextjs-app-support@0.10.0_@apollo+client@3.9.10_next@14.1.4_react@18.2.0/node_modules/@apollo/experimental-nextjs-app-support/dist/empty.js", imported by "src/client/ssr.ts".
Do you have any idea how to solve it? (I get that the error is related to the fact that the library exposes exports using reasct-server )
The text was updated successfully, but these errors were encountered:
I get that the error is related to the fact that the library exposes exports using react-server
Yup, that's the problem. These functions do, in fact, not exist in the node or browser environments, which vite seems to assume here.
My first idea would be to tell vite in some way that @apollo+experimental-nextjs-app-support is external and should not be packaged. That might already keep it from looking at it and complaining about it.
If that's not working, you might have to compile the file in question with a react-server condition. If you have code that relies on node or browser features, that means that you'll have to split it up and compile it twice.
I believe the way of doing that would be a vite config like this:
HI!
I'm creating a library to wrap some precofigured hooks/funcs for my application.
Building it using vite I have this error while trying to import registerApolloClient:
Do you have any idea how to solve it? (I get that the error is related to the fact that the library exposes exports using
reasct-server
)The text was updated successfully, but these errors were encountered: