Next.js & Typescript - Import issues -Attempted import error: 'SliceZone' is not exported from '@prismicio/react'

Hello,

I am getting some type/importation issues with my Next.js 15 app:

 ./prismicio.ts
@repo/web:build: Attempted import error: 'enableAutoPreviews' is not exported from '@prismicio/next' (imported as 'prismicNext').
@repo/web:build: 
@repo/web:build: Import trace for requested module:
@repo/web:build: ./prismicio.ts
@repo/web:build: ./slices/Faq/index.tsx
@repo/web:build: 
@repo/web:build: ./slices/Faq/index.tsx
@repo/web:build: Attempted import error: 'PrismicRichText' is not exported from '@prismicio/react' (imported as 'PrismicRichText').
@repo/web:build: 
@repo/web:build: Import trace for requested module:
@repo/web:build: ./slices/Faq/index.tsx
@repo/web:build: 
@repo/web:build: ./slices/Faq/index.tsx
@repo/web:build: Attempted import error: 'PrismicRichText' is not exported from '@prismicio/react' (imported as 'PrismicRichText').
@repo/web:build: 
@repo/web:build: Import trace for requested module:
@repo/web:build: ./slices/Faq/index.tsx
@repo/web:build: 
@repo/web:build: ./app/(marketing)/[locale]/[uid]/page.tsx
@repo/web:build: Attempted import error: 'SliceZone' is not exported from '@prismicio/react' (imported as 'SliceZone').
@repo/web:build: 
@repo/web:build: Import trace for requested module:
@repo/web:build: ./app/(marketing)/[locale]/[uid]/page.tsx
@repo/web:build: 
@repo/web:build: ./app/(marketing)/[locale]/freelancers/[uid]/page.tsx
@repo/web:build: Attempted import error: 'SliceZone' is not exported from '@prismicio/react' (imported as 'SliceZone').
@repo/web:build: 
@repo/web:build: Import trace for requested module:
@repo/web:build: ./app/(marketing)/[locale]/freelancers/[uid]/page.tsx
@repo/web:build: 
@repo/web:build: ./app/(marketing)/[locale]/freelancers/page.tsx
@repo/web:build: Attempted import error: 'SliceZone' is not exported from '@prismicio/react' (imported as 'SliceZone').
@repo/web:build: 
@repo/web:build: Import trace for requested module:
@repo/web:build: ./app/(marketing)/[locale]/freelancers/page.tsx
@repo/web:build: 

How come? I dont understand what's the typing issue.

Stack;

  • Next js 15
  • React 19
  • "@prismicio/client": "^7.14.0",
  • "@prismicio/next": "^1.7.1",
  • "@prismicio/react": "^2.9.1",
  • "@slicemachine/adapter-next": "^0.3.62",

slicemachine.config.json:

{
  "repositoryName": "freel-canada",
  "adapter": "@slicemachine/adapter-next",
  "libraries": ["./slices"],
  "localSliceSimulatorURL": "http://localhost:3000/slice-simulator"
}

dedicated ts.config.json:

{
	"extends": "@repo/tsconfig/nextjs.json",
	"compilerOptions": {
		"plugins": [{ "name": "next" }],
		"paths": {
			"@analytics": ["./modules/analytics"],
			"@marketing/*": ["./modules/marketing/*"],
			"@saas/*": ["./modules/saas/*"],
			"@ui/*": ["./modules/ui/*"],
			"@i18n": ["./modules/i18n"],
			"@i18n/*": ["./modules/i18n/*"],
			"@shared/*": ["./modules/shared/*"],
			"content-collections": ["./.content-collections/generated"]
		}
	},
	"include": [
		"**/*.ts",
		"**/*.tsx",
		"**/*.cjs",
		"**/*.mjs",
		".next/types/**/*.ts",
		"next-env.d.ts",
		".slicemachine/prismicio.d.ts"
	],
	"exclude": ["node_modules"]
}

Thanks for the help!

Hi @Marving, I suspect something in your tsconfig.json or package.json files is causing this error.

Could you share your @repo/tsconfig/nextjs.json and package.json files?

1 Like

Thank you for coming back to me @angeloashmore! (Hope you're doing good btw :pray:)

Sorry for the late reply. I've been able to fix it. Clear a bunch of stuff such as cache, node_module, next js folder etc helped me fixed it :)

Thank you!!

1 Like