v11.0.3 breaks with error Module not found: Can't resolve 'fs'
Just been trying to update my quite out of date contentful package and when I get to 11.0.3 I get the following error:
Import trace for requested module:
./src/pages/news.js
⨯ ./node_modules/.pnpm/[email protected]/node_modules/contentful/dist/contentful.cjs:9:1
Module not found: Can't resolve 'fs'
7 | var require$$4 = require('https');
8 | var require$$0$2 = require('url');
> 9 | var require$$6 = require('fs');
| ^
10 | var require$$4$1 = require('assert');
11 | var require$$0$4 = require('tty');
12 | var require$$0$3 = require('os');
https://nextjs.org/docs/messages/module-not-found
I am using the latest Next.js version 15.3.2 and dropping to 11.0.0 doesn't display the error
Hi @thomasbritton, this migration guide and this other issue should give you some helpful guidance on how to resolve this.
I would love to help you with this, we have two setups of nextjs that test this library with nextjs 15.1.3
https://github.com/axe312ger/contentful-compatibility-cda/tree/main/environments/nextjs https://github.com/axe312ger/contentful-compatibility-cda/tree/main/environments/nextjs-ts
As you can see there, it works without adding any extra config to the next.config.js files.
Could you compare our setups with yours, maybe you can find the difference or cause of this issue? If so, please let us know!