svelte-swiper icon indicating copy to clipboard operation
svelte-swiper copied to clipboard

ReferenceError: window is not defined

Open Absleepy opened this issue 1 year ago • 2 comments

@patricknelson I was trying to use the svelte-swiper and it's not showing anything. I see the referenceError in the console.

Absleepy avatar Jul 06 '23 08:07 Absleepy

No description provided.

patricknelson avatar Aug 08 '23 22:08 patricknelson

Please add the ability to use svelte SSR.

Internal server error: window is not defined
      at Object.<anonymous> (\node_modules\.pnpm\[email protected]\node_modules\svelte-swiper\dist\bundle.js:1:224)

I think to solve this issue, you need to add the option output: { globalObject: 'this' } in webpack.config.js.

Additionally, I'd recommend adding the package.json.lock file to the repository, locking down all dev dependencies, and update them manually only. I tried compiling the project just now and couldn't, no matter what I did. I encountered a lot of unclear errors, and it feels easier to just rebuild the whole bundler from scratch. For my own use, I've decided to simply copy the component files into my project.

NikolayMakhonin avatar Sep 18 '23 10:09 NikolayMakhonin