Module not found: Can't resolve '../../slices' when uploading project to Vercel

Hello everyone, I've successfully completed my project, and it functions perfectly on localhost. However, when I attempt to deploy it on Vercel, I encounter the following error.

[03:40:09.686]    Creating an optimized production build ...
[03:40:14.694] Failed to compile.
[03:40:14.694] ./src/app/slice-simulator/page.tsx
[03:40:14.694] Module not found: Can't resolve '../../slices'
[03:40:14.695] > Build failed because of webpack errors
[03:40:14.723] Error: Command "npm run build" exited with 1

Is there a solution to address this issue?

Hi Justin,

I'll be happy to help with this.

Did you test opening the Slice Simulator when working locally?


Hi Phil,

Locally everything works fine!

Previewing Slices included?

Yes everything works fine local but when i try to deploy it on Vercel i get that error.

I followed this tutorial:

Do you have your project on GitHub and can maybe provide me a link?

Yes i'll send you it!

Github: GitHub - OftewelJustin/flowrise-prismic

OK, can you try changing the import in the file to:

Wait sorry

Where do i have to import it?

You haven't added any Slices to your project yet.

Okay how do i do that?

The tutorial you're following should show you how to do that. You don't need to deploy yet, try following until you add some Slices and then deploy.

import { components } from "../../slices"; is searching for a folder that doesn't exist yet.

Thank you a lot, i forget to import import { SliceZone } from "@prismicio/react"; into my slices!