Skip to content

fix(core): prevent duplicate module initialization in constructor#8156

Merged
nolimits4web merged 1 commit intonolimits4web:masterfrom
mst-mkt:master
Feb 13, 2026
Merged

fix(core): prevent duplicate module initialization in constructor#8156
nolimits4web merged 1 commit intonolimits4web:masterfrom
mst-mkt:master

Conversation

@mst-mkt
Copy link
Copy Markdown
Contributor

@mst-mkt mst-mkt commented Feb 1, 2026

issues

resolve #8155

Description

Prevents duplicate module initialization when modules are specified in both Swiper.use() and constructor options.

Changes

Added duplicate check in constructor's module initialization to match Swiper.installModule() behavior. Modules now initialize only once regardless of registration method.

swiper/src/core/core.mjs

Lines 718 to 725 in 3a1777a

static installModule(mod) {
if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = [];
const modules = Swiper.prototype.__modules__;
if (typeof mod === 'function' && modules.indexOf(mod) < 0) {
modules.push(mod);
}
}

@nolimits4web nolimits4web merged commit 07738a2 into nolimits4web:master Feb 13, 2026
@nolimits4web
Copy link
Copy Markdown
Owner

Merged, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate module initialization with Swiper.use() and modules

2 participants