adamsoffer/next-apollo

Module not found

Closed this issue · 3 comments

Hi Adam,

I am getting this error when i try to just
import { withData } from 'next-apollo'

./node_modules/next-apollo/dist/link.js
Module not found: Can't resolve 'next-server/dist/lib/utils' in '/Users/***/node_modules/next-apollo/dist'

These are my dependencies:

"dependencies": {
    "@apollo/react-hooks": "^3.1.1",
    "@apollo/react-ssr": "^3.1.1",
    "@zeit/next-css": "^1.0.1",
    "antd": "^3.9.2",
    "apollo-boost": "^0.4.4",
    "babel-plugin-import": "^1.9.1",
    "graphql": "^14.5.6",
    "next": "latest",
    "next-apollo": "^3.1.4",
    "null-loader": "2.0.0",
    "react": "^16.7.0",
    "react-dom": "^16.7.0"
  }

Hey @nguyenDalex! I'm not Adam, but it appears that the issue is with next 9.0.6. Try locking next to 9.0.5 until this gets fixed.

Specifically, this change moved next-server back into next package, resulting in path changes.

This fixes it thank you! Not related to issue, but what is the difference between using next-apollo and apollo-boost directly? I'm still new to nextjs.

Thanks for the heads up @freeatnet. I'll remove that dep in the next release.

@nguyenDalex next-apollo is simply an abstraction of the integration to get apollo working in a nextjs app. In the future, I plan on adding some extra helpers components to this package. For example, an extension of the nextjs Link component that supports data prefetching.