External Dependencies not working in Nav.svelte
Asked Answered
L

1

7

I am trying to load sv-bootstrap-dropdown module in nav.svelte component but I am getting the error <Dropdown> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. After that I tried to install that as devDependency but than I was getting the error that Cannot read property remove of undefined. This gets generated itself in the server js file under the sapper folder

Lacroix answered 22/11, 2020 at 17:43 Comment(1)
I haven't had any luck getting this working either - any help would be appreciated!Modesta
M
5

When working with svelte and sapper you to have think about 2 types of rendering : client side rendering (sveltjs, js) and server side rendering (SSR), it's sapper (nodejs or expressjs), there are a few ways to handle this, but according to the document of dependency you are using :

for SSR you consider to import like this:

import {
      Carousel,
      CarouselControl,
      CarouselIndicators,
      CarouselItem,
      CarouselCaption
    } from 'sveltestrap/src';

solve it by importing from the src folder of the package.

Mitsue answered 5/12, 2020 at 3:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.