prismicio / slice-simulator

Preview and develop Prismic slices fast with minimal configuration
6 stars 5 forks source link

SliceCanvas replaces dynamic Nuxt routes #3

Closed samuelhorn closed 2 years ago

samuelhorn commented 2 years ago

Versions

Reproduction

Tried to replace Storybook in the new blog repo and run in to some issues:

The docs says to use: "localSliceCanvasURL": "http://localhost:3000/_canvas" but SM tells me that I need: "localSlicePreviewURL": "http://localhost:3000/_preview", this is kind of confusing.

  1. When going for the "localSlicePreviewURL": "http://localhost:3000/_canvas": I get previews working inside SM, but problem is I can't access my posts which lives in /pages/_post.vue since Nuxt thinks it should use _canvas for post rendering instead, this is because _canvas comes before _post alphabetically. This results in an error page that says "You're seeing this page because you're accessing Slice Canvas directly" when trying to reach a post in Nuxt.
  2. If I instead use: "localSlicePreviewURL": "http://localhost:3000/_preview", then SliceCanvas preview tries to render a post since Nuxt choses _post before _preview.
lihbr commented 2 years ago

Fixed, new recommended route is slice-simulator.vue