prismic-react icon indicating copy to clipboard operation
prismic-react copied to clipboard

slice-machine-ui 1.4.0: "Error: Cannot find module 'next/headers'"

Open loick opened this issue 2 years ago • 4 comments

Hi there,

I noticed the following error on the slice-machine-ui version 1..4.0: Error: Cannot find module 'next/headers'

As explained in a previous issue raised, my package does not rely on nextJS. I added the nextJS adapter because I had to choose one, but my JS module is actually SSR framework agnostic (I rely on React though).

If I can do anything to help, let me know.

Thanks!

loick avatar Jul 03 '23 10:07 loick

Also, this release seems to have several issues:

  • The build status of the publish commit is red.
  • The weight of the package is 13.5 MB according to npm, even bundlephobia is crashing when trying to analyze it.

loick avatar Jul 04 '23 14:07 loick

Any news on this? 👋

loick avatar Jul 10 '23 14:07 loick

Hi @loick, you can likely fix this issue by installing Next.js v13 as a dev dependency:

npm install --save-dev next@latest

As long as you aren't using any of Slice Machine's generated files (except the TypeScript types in prismicio-types.d.ts), the next package shouldn't affect your project.

You could also check your project for any instances of next/headers and remove them. @slicemachine/init generates a /api/preview endpoint in Next.js projects which uses next/headers. If you have that file, you can delete it.

angeloashmore avatar Jul 11 '23 06:07 angeloashmore

Hi Angel,

I would like to avoid installing big dependencies like this (13.5Mb for slicemachine is huge), and in addition putting NextJS inside my project is highly confusing (especially because I don't use it).

Is it possible to simply have the ability to query the CMS content, only be tied to React or Vue eventually and that's it?

loick avatar Jul 11 '23 08:07 loick