# Slice Machine libraries path breaks slice-machine-ui

**URL:** <https://community.prismic.io/t/slice-machine-libraries-path-breaks-slice-machine-ui/5921>\
**Category:** Developing with Prismic\
**Tags:** slice-machine\
**Created:** [June 23, 2021, 9:31pm UTC](https://community.prismic.io/t/slice-machine-libraries-path-breaks-slice-machine-ui/5921 "2021-06-23T21:31:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jesse](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jesse/32/2425_2.png) [@jesse](https://community.prismic.io/u/jesse)\
**Post date:** [June 23, 2021, 9:31pm UTC](https://community.prismic.io/t/slice-machine-libraries-path-breaks-slice-machine-ui/5921/1 "2021-06-23T21:31:32Z")

</div>

I'm rebuilding my existing slices for my Nextjs project using slice machine, primarily for the variations (great feature). However, I'm trying to maintain my current project structure, which has everything within different folders in `src`, however, in `sm.json`, if I try and define my `libraries` path as anything other than `@/slices` with `slices` in the root directory then my variations don't swap. In other words, I can create new variations, but when I try and navigate between them to make changes it doesn't actually swap between them.

I'm using `slice-machine-ui@0.1.0-alpha.7`. Any ideas how to fix this?

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [June 24, 2021, 3:10pm UTC](https://community.prismic.io/t/slice-machine-libraries-path-breaks-slice-machine-ui/5921/2 "2021-06-24T15:10:22Z")

</div>

Hi Jesse,

I'm not 100% sure what you mean here.

What do the files you're trying to link contain? How does the `sm.json` look with your updated info?

What exactly do you mean when you say the "my variations don't swap"?

Thanks.

---

<div class="post-metadata">

**Author:** ![jesse](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jesse/32/2425_2.png) [@jesse](https://community.prismic.io/u/jesse)\
**Post date:** [June 24, 2021, 3:18pm UTC](https://community.prismic.io/t/slice-machine-libraries-path-breaks-slice-machine-ui/5921/4 "2021-06-24T15:18:31Z")

</div>

Yeah, I can definitely clarify.

So, if I change my `sm.json` to use a different path for the library, like so:

```auto
{
  "apiEndpoint": "https://my-endpoint.prismic.io/api/v2",
  "pathToLibrary": "src",
  "libraries": ["@/src/slices", "essential-slices"],
  "_latest": "0.1.0",
  "storybook": "http://localhost:6006"
}

```

I can still launch slice machine and see my slices.

 ![Screen Shot 2021-06-24 at 11.14.34 AM](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/f/f1a71725f3a0d2ce6966b1800afd41ebd3655c7a.jpeg)

But if I navigate into my `HeroSlice` for example, with two variations, when I use the select to swap between the variations and make edits the route doesn't change, nor does the variant that I'm trying to edit.

 ![Screen Shot 2021-06-24 at 11.15.26 AM](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/b/b8cb874bcf33b3ff66b32145ea57bb1837a307c8.jpeg)  
 ![Screen Shot 2021-06-24 at 11.15.19 AM](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/3/37edffa9e7a5aea406eea9d31704d82c8d8f0f8a.jpeg)  
 ![Screen Shot 2021-06-24 at 11.15.26 AM](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/a/a24afb8d707a306271222edcac511fe85ad6812f.png)

This problem only happens if I don't have my slices in the root directory.

---

<div class="post-metadata">

**Author:** ![hugo.villain](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/hugo.villain/32/186_2.png) [@hugo.villain](https://community.prismic.io/u/hugo.villain)\
**Post date:** [June 24, 2021, 3:23pm UTC](https://community.prismic.io/t/slice-machine-libraries-path-breaks-slice-machine-ui/5921/5 "2021-06-24T15:23:39Z")

</div>

Thanks for your detailed answer!  
Would you mind sharing the model of your slice?

---

<div class="post-metadata">

**Author:** ![jesse](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jesse/32/2425_2.png) [@jesse](https://community.prismic.io/u/jesse)\
**Post date:** [June 24, 2021, 3:24pm UTC](https://community.prismic.io/t/slice-machine-libraries-path-breaks-slice-machine-ui/5921/6 "2021-06-24T15:24:43Z")

</div>

You got it, thanks for the assistance!

```auto
{
  "id": "hero_slice",
  "type": "SharedSlice",
  "name": "HeroSlice",
  "description": "HeroSlice",
  "variations": [
    {
      "id": "heroWithImage",
      "name": "Hero - With Image",
      "docURL": "...",
      "version": "sktwi1xtmkfgx8626",
      "description": "HeroSlice",
      "primary": {
        "includeLocation": {
          "config": {
            "label": "Include Location",
            "placeholder_false": "false",
            "placeholder_true": "true",
            "default_value": true
          },
          "type": "Boolean"
        },
        "title": {
          "config": {
            "label": "Title",
            "placeholder": "This is where it all begins...",
            "allowTargetBlank": true,
            "single": "heading1"
          },
          "type": "StructuredText"
        },
        "description": {
          "type": "StructuredText",
          "config": {
            "single": "paragraph",
            "label": "Description",
            "placeholder": "A nice description of your feature"
          }
        },
        "defaultButtonLabel": {
          "config": {
            "label": "Default Button Label",
            "placeholder": "Enter default button label..."
          },
          "type": "Text"
        },
        "defaultButtonLink": {
          "config": {
            "label": "Default Button Link",
            "placeholder": "Select default link...",
            "allowTargetBlank": true
          },
          "type": "Link"
        },
        "image": {
          "config": {
            "label": "Image",
            "constraint": {
              "width": 2500,
              "height": 1800
            },
            "thumbnails": []
          },
          "type": "Image"
        }
      },
      "items": {}
    },
    {
      "id": "heroWithVideo",
      "name": "Hero - With Video",
      "docURL": "...",
      "version": "sktwi1xtmkfgx8626",
      "description": "HeroSlice",
      "primary": {
        "includeLocation": {
          "config": {
            "label": "Include Location",
            "placeholder_false": "false",
            "placeholder_true": "true",
            "default_value": true
          },
          "type": "Boolean"
        },
        "title": {
          "type": "StructuredText",
          "config": {
            "single": "heading1",
            "label": "Title",
            "placeholder": "This is where it all begins..."
          }
        },
        "description": {
          "type": "StructuredText",
          "config": {
            "single": "paragraph",
            "label": "Description",
            "placeholder": "A nice description of your feature"
          }
        },
        "defaultButtonLabel": {
          "config": {
            "label": "Default Button Label",
            "placeholder": "Enter default button label..."
          },
          "type": "Text"
        },
        "defaultButtonLink": {
          "config": {
            "label": "Default Button Link",
            "placeholder": "Select default link...",
            "allowTargetBlank": true
          },
          "type": "Link"
        },
        "videoPoster": {
          "config": {
            "label": "Video Poster",
            "constraint": {
              "width": 1920,
              "height": 1080
            },
            "thumbnails": []
          },
          "type": "Image"
        },
        "video": {
          "config": {
            "label": "Video",
            "placeholder": "Select the video...",
            "allowTargetBlank": true
          },
          "type": "Link"
        },
        "backgroundVideo": {
          "config": {
            "label": "Background Video",
            "placeholder": "Select background video...",
            "allowTargetBlank": true
          },
          "type": "Link"
        }
      },
      "items": {}
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [July 5, 2021, 1:30pm UTC](https://community.prismic.io/t/slice-machine-libraries-path-breaks-slice-machine-ui/5921/7 "2021-07-05T13:30:35Z")

</div>

Hi Jesse,

So Hugo looked at this and the Variation link in the Popover didn't take into account sub-routes. He updated and is currently publishing `slice-machine-ui@0.1.0-alpha.11`

---

<div class="post-metadata">

**Author:** ![hugo.villain](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/hugo.villain/32/186_2.png) [@hugo.villain](https://community.prismic.io/u/hugo.villain)\
**Post date:** [July 5, 2021, 1:53pm UTC](https://community.prismic.io/t/slice-machine-libraries-path-breaks-slice-machine-ui/5921/8 "2021-07-05T13:53:13Z")

</div>

Hey @jesse can you give [0.1.0-beta.1](https://www.npmjs.com/package/slice-machine-ui/v/0.1.0-beta.1) a try?

---

<div class="post-metadata">

**Author:** ![jesse](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/jesse/32/2425_2.png) [@jesse](https://community.prismic.io/u/jesse)\
**Post date:** [July 7, 2021, 3:42pm UTC](https://community.prismic.io/t/slice-machine-libraries-path-breaks-slice-machine-ui/5921/9 "2021-07-07T15:42:20Z")

</div>

I can indeed, thank you!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [July 12, 2021, 9:44am UTC](https://community.prismic.io/t/slice-machine-libraries-path-breaks-slice-machine-ui/5921/10 "2021-07-12T09:44:44Z")

</div>

Threads close after a period of inactivity. [Flag this thread](https://community.prismic.io/t/re-open-a-thread/2175) to re-open it and continue the conversation.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 5:49pm UTC](https://community.prismic.io/t/slice-machine-libraries-path-breaks-slice-machine-ui/5921/11 "2021-12-09T17:49:21Z")

</div>


