Ahmed
Ahmed

Reputation: 525

The requested module '@glidejs/glide' does not provide an export named 'default'

I have a svelte website & I'm using glidejs. Everything is working fine on my localhost, but once I deployed, I'm getting this error. I'm using node server adapter

SyntaxError: The requested module '@glidejs/glide' does not provide an export named 'default'

at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)

at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

I'm importing glide correctly -it's working on localhost-

import Glide from '@glidejs/glide';

What could be the reason & how to fix it?

The issue happened on render.com & a2hosting.com

Upvotes: 1

Views: 626

Answers (2)

Ahmed
Ahmed

Reputation: 525

The issue is gone once I imported glide like this

<svelte:head>
    <script src="node_modules/@glidejs/glide/dist/glide.min.js"></script>
    <link rel="stylesheet" href="../node_modules/@glidejs/glide/dist/css/glide.core.min.css" />
</svelte:head>

But still, I'm curious to know why it happens with sveltekit when it's imported like this

import Glide from '@glidejs/glide';

Upvotes: 0

Andrew Zagarichuk
Andrew Zagarichuk

Reputation: 509

I'm using Glide with nuxt3 and has the same error, but as workaround I found that some, trick works for me:

import * as Glide from "@glidejs/glide";

then

new Glide.default(".glide", options).mount();

or just use another import:

import Glide from '@glidejs/glide/dist/glide.esm'

Upvotes: 0

Related Questions