Skip to content

Migrate to v2

v2 is a near ground-up rewrite of svelte-cloudinary, including significant type improvements. This will undoubtedly cause many minor typing issues that would be impractical to cover in this guide. We’ll cover the major changes here that you can easily check for and change, and for the type errors, we recommend running svelte-check on your codebase. We hope that this rewrite will make it much easier for us to maintain this library into the future, especially with Svelte 5 on the horizon. If there is anything we’ve missed, or you have any issues, then let us know. We’ll keep updating this guide as needed to make it as frictionless as possible!

Configuration

The following environment variables have been renamed, the old names will be removed in the next major version:

Old NameNew NameDescription
VITE_PUBLIC_CLOUDINARY_CLOUD_NAMEVITE_CLOUDINARY_CLOUD_NAMEYour Cloudinary cloud name
VITE_PUBLIC_CLOUDINARY_API_KEYVITE_CLOUDINARY_API_KEYAPI key for use with the upload widget

Read more about Configuring Svelte Cloudinary here, including the new configureCloudinary function.

CldImage

transformations

transformations has been deprecated in favour of namedTransformations and will be removed in the next version.

CldOgImage

The alt prop is now required.

CldUploadWidget

Events

The onUpload event has now been deprecated, and will be removed in the next major version. You should migrate to onSuccess, which has a similar behaviour.

CldVideoPlayer

playerRef

The playerRef prop has been renamed to player, and is still readonly.

videoRef

The videoRef prop has been renamed to videoElement, and is still readonly.

Version Prop

The version prop has been removed and is now controlled and updated internally.

getCldImageUrl

The GetCldImageUrl, GetCldImageUrlOptions, GetCldImageUrlConfig, and GetCldImageUrlAnalytics types were removed. You can import ImageOptions, ConfigOptions, and AnalyticsOptions from @cloudinary-util/url-loader if you need these.

getCldOgImageUrl

The GetCldOgImageUrl type was removed. You can import ImageOptions, ConfigOptions, and AnalyticsOptions from @cloudinary-util/url-loader if you need these.

Dependencies

The utility libraries we use had some breaking changes, as well as new features:

LibraryOld VersionNew Version
@cloudinary-util/url-loaderv3v5Changelog
@cloudinary-util/utilv2v3Changelog
@cloudinary-util/typesn/av1Changelog