Skip to content

[js] Update swiper 12.1.4 → 14.0.0 (major)#799

Merged
digitaltom merged 1 commit into
mainfrom
depfu/update/importmap/swiper-14.0.0
Jun 28, 2026
Merged

[js] Update swiper 12.1.4 → 14.0.0 (major)#799
digitaltom merged 1 commit into
mainfrom
depfu/update/importmap/swiper-14.0.0

Conversation

@depfu

@depfu depfu Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Here is everything you need to know about this upgrade. Please take a good look at what changed and the test results before merging this pull request.

What changed?

✳️ swiper (12.1.4 → 14.0.0) · Repo · Changelog

Release Notes

14.0.0

Swiper v14 is a ground-up TypeScript rewrite of the entire codebase, focused on smaller bundles, more accurate types, and a modern browser baseline. (We skipped v13.)

Upgrading from v12 requires no code changes. Every option, default, event, payload, method signature, and module import (swiper/modules, swiper/react, swiper/vue, swiper/element, …) behaves exactly as before. The only differences you may notice are tighter TypeScript types and a narrower set of supported browsers — see Breaking Changes below.

Highlights

  • Single TypeScript source of truth. src/ is now .ts/.tsx. The hand-maintained .d.ts tree (src/types/, the per-module .d.ts files) is gone — declarations are emitted directly from the runtime source with tsc, so the shipped types can no longer drift from the implementation. Several signatures that used to be any are now correctly typed (e.g. getTranslate(): number).
  • Per-module type augmentation. Each module augments the central Swiper / SwiperOptions / SwiperEvents interfaces. Importing a module (e.g. import { Navigation } from 'swiper/modules') brings its option, method, and event types along with it — mirroring how the runtime already requires registration.
  • More reliable type resolution. Types now resolve correctly under classic node, node16/nodenext, and bundler module resolution, and swiper/bundle exposes every module's options out of the box. Verified by a consumer-simulation test suite.
  • Zero runtime dependencies. The ssr-window dependency was removed and replaced with inline environment guards. Swiper now installs with no transitive runtime deps.
  • Smaller minified bundles. Legacy DOM-compat helpers and below-baseline feature detection were removed. The shared DOM utils shrank ~28%, and the main builds are ~2–4% smaller minified (swiper.min.js −4.1%, swiper-element.min.js −2.9%, swiper-bundle.min.js −2.3%).
  • Babel removed from the build. TypeScript now handles the JSX transform for the React wrapper, and @babel/preset-env is a no-op at the v14 baseline. Runtime output is byte-identical (React output is marginally smaller).

Breaking Changes

  • Browser baseline raised to the last ~2 years of evergreen browsers. Swiper v14 targets Chrome / Edge 110+, Safari 16.4+ (iOS 16.4+), and Firefox 110+. Code paths and feature detection for older browsers were removed (e.g. the smoothScroll support flag, the Safari < 16.2 perspective workaround, and the legacy DocumentTouch touch check). iOS/Android-specific quirk handling is kept but simplified. If you need to support older browsers, stay on v12.
  • Node.js >= 20.19.0 is now required to build/develop against the package (engines was >= 4.7.0). This does not affect the browser runtime.
  • Type-level changes. Stricter types may surface latent issues in code that previously relied on any-typed access to Swiper internals. These are compile-time only — there are no runtime behavior changes.

SSR

ssr-window's mock window/document were replaced with inline typeof guards. Server rendering with the React / Vue / Element wrappers is unaffected — they only instantiate Swiper in client-side mount effects. Imperatively calling new Swiper(...) in a pure Node (non-DOM) environment once again no-ops gracefully, matching v12 behavior, and is now locked down by a dedicated SSR runtime test.

12.2.0

Bug Fixes

  • avoid duplicate css type resolutions (aaf6014)
  • core: guard against stale event listeners in onTouchEnd and onTouchMove (00fe610)
  • core: guard all event handlers against stale invocations on destroyed swiper (3b2b85f)
  • types: support boolean as controller type (b10f9e0)

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by 56 commits:


Depfu Status

Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.

All Depfu comment commands
@​depfu rebase
Rebases against your default branch and redoes this update
@​depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@​depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@​depfu cancel merge
Cancels automatic merging of this PR
@​depfu close
Closes this PR and deletes the branch
@​depfu reopen
Restores the branch and reopens this PR (if it's closed)
@​depfu pause
Ignores all future updates for this dependency and closes this PR
@​depfu pause [minor|major]
Ignores all future minor/major updates for this dependency and closes this PR
@​depfu resume
Future versions of this dependency will create PRs again (leaves this PR as is)

@depfu depfu Bot added the depfu label Jun 27, 2026
@digitaltom digitaltom merged commit 6694f9a into main Jun 28, 2026
8 checks passed
@depfu depfu Bot deleted the depfu/update/importmap/swiper-14.0.0 branch June 28, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant