RangeError in Swiper JS Integration

Created on 31 October 2024, 16 days ago

Problem/Motivation

When initializing Swiper JS within a Drupal behavior, a "Uncaught RangeError: Invalid string length" error occurs. This error seems to originate from within the Swiper library itself, specifically when creating a new Swiper instance using new Swiper().

Steps to reproduce

1. Install and enable Swiper Formatter (or your module/theme).
2. In Swiper template settings choose remote library
3. Load a page where the Swiper field is displayed.
4. Observe the browser console for the "Uncaught RangeError: Invalid string length" error.

Proposed resolution

The problem is definitely in cont swiperSettings.
Review and correct the swiperSettings object: Ensure all properties have valid values and data types according to the Swiper JS API documentation.

Reminder: We are using swiper@11.1.0 version

I've made a couple tests and put a properly filled up swiperSettings and error disappear.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇨🇦Canada man-1982

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @man-1982
  • 🇨🇦Canada man-1982

    i can reproduce it only if before i had old configuration from previous version "Swiper formatter"
    If you have fresh new version Swiper formatter and a create new teplate profile it can't be reproduce.

    Close that ticket as won't be reproduce

    thanks

Production build 0.71.5 2024