Pain points with Slice Machine

I've been struggling with some pieces of using Slice Machine for a while now and wanted to write it up here to get thoughts from others in the community.

Maybe I'm doing something wrong. Maybe this is something other people are finding too.

I built my site - - in NextJS version 10 using Slice Machine.

When I upgraded to NextJS version 11 last year I found it very difficult to do so and maintain the existing slices created with slice machine in my project.

Now NextJS 12 is out and Prismic have updated their CLI and React/Next components I'm finding that upgrading is pretty much impossible. There's just too many errors cropping up when I try and none of them give me any real indication of what the issue really is.

I feel that my only choice at this point it to spin up a new project and rebuild the site, copying components & CSS over as needed.

The problem I have now is that I can't seem to find a way to hook the existing slices up to slice machine in the new project.

Am I missing something? How do you handle upgrading slice machine projects?

Am I better to not use slice machine and build the slices manually in my prismic repo?

Hey, @lee. Thank you for sharing your thoughts.

I have just informed the Slice Machine team about your use case. They'll give us their opinion and best recommendations on it.

We'll get back to you as soon as possible.

Hello @lee, we're having a chat with the team. We'd like to know some more details about your project:

  • Do you know the versions of Slice Machine you used before upgrading? If you know the versions of the prismic CLI and the React library. Those can be useful as well.
  • What happens exactly when you try to handle the Slices?
  • Could you show us examples of the errors you're experiencing?

We look forward to your response

The team's first recommendation is to wait for proper migration tools to be created. Since you're still in the pre-shared slices era of Slice Machine.

Thanks @Pau - so Slice machine is basically of no use to anyone building production sites until you get around to creating migration tools to allow an upgrade path between different versions of NextJS or to allow slice machine slices to be shared between projects?

This doesn't make much business sense to me as I would think you'd want developers and digital agencies to sell your product for you?

As a senior web developer in a digital agency (who also freelances) I want to create a standard slice library that I can simply clone into new projects and push to prismic so that I can use Prismic and NextJS for clients' websites without having to spend hours or days re-creating slices every single time.

What you're basically saying is that we have to manually rebuild every slice via slice machine in each new project, even if we have that slice in another project already.

How difficult is it to have a CLI command that would look at the slice configs in the current project and push them to the project's prismic repository?

If that existed we could have a template project that we can clone for each new client project, push the slices to the client's new prismic repository and get to work on skinning it for their brand.

We are working to make Slice Machine more and more stable and suitable for projects in production.

It is possible to migrate a pre-shared slices project to the latest version of Slice Machine. We did not openly recommend going this because there is no one-way path to do this migration. Each project is different. For example, we had a case where a user found an odd behavior when a shared slice and a legacy slice shared the same slice ID, and only the legacy one was showing.

But, you can do it progressively. In synthesis:

  • You can reuse the content modeling of your Slices if you already have their JSON definition in your code
  • You will have to redo all the content in your new repository.
  • About the React Library, this can be upgraded independently from any Slice Machine updates. You can continue using prismic-reactjs in older or current Slice Machine versions. Or you can upgrade now sing our migration guide to the latest version of @prismicio/react.