swiper icon indicating copy to clipboard operation
swiper copied to clipboard

Uncaught TypeError: Cannot read properties of undefined (reading 'lazyPreloaderClass')

Open BerkeAras opened this issue 1 year ago • 5 comments

Check that this is really a bug

  • [x] I confirm

Reproduction link

https://codesandbox.io/p/devbox/swiper-default-forked-6c96g3?workspaceId=ws_NcfeSzfz6N96RJW7VKTnaL

Bug description

We are getting an error Uncaught TypeError: Cannot read properties of undefined (reading 'lazyPreloaderClass').

Due to our complex case (combining VueJS with other technologies) we cannot reproduce the issue.

Expected Behavior

No response

Actual Behavior

No response

Swiper version

11.2.6

Platform/Target and Browser Versions

macOS Arc Browser, same issue on Windows/Linux/iOS/Android and on other browsers too.

Validations

  • [x] Follow our Code of Conduct
  • [x] Read the docs.
  • [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • [x] Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • [x] I'm willing to open a PR

BerkeAras avatar Mar 28 '25 09:03 BerkeAras

Yes, it’s a rare issue. I stumbled upon it as well. Hopefully, they accept your pull request or find another way to fix this issue, since it’s spamming my error log.

Scribilicious avatar Mar 28 '25 09:03 Scribilicious

Yes, it’s a rare issue. I stumbled upon it as well. Hopefully, they accept your pull request or find another way to fix this issue, since it’s spamming my error log.

Could you find any fix until the PR is merged & released? @Scribilicious

BerkeAras avatar Mar 28 '25 10:03 BerkeAras

I have the exact same problem. I'm using Angular 20 with SSR.

app.config.ts:30  ERROR TypeError: Cannot read properties of undefined (reading 'lazyPreloaderClass')
    at swiper-core.mjs:907:73
    at timer (zone.js:1809:37)
    at _ZoneDelegate.invokeTask (zone.js:431:33)
    at ZoneImpl.runTask (zone.js:161:47)
    at invokeTask (zone.js:515:34)
    at ZoneTask.invoke (zone.js:504:48)
    at data.args.<computed> (zone.js:1778:32)
    "swiper": "^11.2.8",

wikylyu avatar Aug 18 '25 09:08 wikylyu

import { register } from 'swiper/element';
register()

register() raise the error.

wikylyu avatar Aug 18 '25 09:08 wikylyu

I'm also facing this error with Blazor Static SSR with Enhanced Navigation (.NET 9)

mdmontesinos avatar Sep 29 '25 14:09 mdmontesinos