cloudinary-community / svelte-cloudinary

⚡️ High-performance image delivery and uploading at scale in Svelte powered by Cloudinary.
https://svelte.cloudinary.dev/
MIT License
24 stars 11 forks source link

[Bug] Remove `VITE_` for SvelteKit .env variable #105

Open mislam opened 3 months ago

mislam commented 3 months ago

Bug Report

Describe the bug

After upgrading from v1.2.3 to v1.3.1, I noticed the .env variable changed: from PUBLIC_CLOUDINARY_CLOUD_NAME to -> VITE_PUBLIC_CLOUDINARY_CLOUD_NAME

The use of VITE_ is counter-intuitive for SvelteKit project. It makes more sense to do one of the 3 options:

Option 1: Revert back to PUBLIC_CLOUDINARY_CLOUD_NAME, or Option 2: Let the developer decide on naming and have a config/init to manually initialize the component using the custom env variable name. Option 3. Let both naming (with and w/o VITE_) work, if some people prefer to must have VITE_.

Is this a regression?

Did this behaviour used to work in the previous version? Yes, the previous version in which this bug was not present was: v1.2.3

Steps To Reproduce the error

  1. Create a SvelteKit project
  2. npm install svelte-cloudinary v1.2.3
  3. Use .env variable PUBLIC_CLOUDINARY_CLOUD_NAME
  4. Then upgrade the package to v1.3.1

Expected behaviour

Like all other SvelteKit .env variable naming convention, the VITE_ prefix should be removed.

Your environment

colbyfayock commented 3 months ago

hey @mislam - 1.2.1 attempted to introduce a new ENV configuration that would allow for both patterns of VITE and PUBLIC to work: https://github.com/cloudinary-community/svelte-cloudinary/pull/82

however, the issue with this, is it inadvertently broke vanilla Svelte installations, and while SvelteKit likely makes up the majority of use, it was a breaking change that shouldn't have been released as a minor update (if at all), hence the decision to revert it: https://github.com/cloudinary-community/svelte-cloudinary/pull/97

we're trying to figure out a solution that would allow for use of different ENV naming patterns to let any Svelte project utilize this library, whether VITE, PUBLIC, or another less frequent pattern, but need to figure out a good way to handle that

thanks for sharing some ideas on how to move forward with that idea, i'll let the maintainer chime in when she has time about what she had in mind as well

enesbala5 commented 1 day ago

Facing this issue also. For now I'm having to define it twice, which is unnecessarily verbose. Hoping this is solved soon.

ghostdevv commented 1 day ago

Facing this issue also. For now I'm having to define it twice, which is unnecessarily verbose. Hoping this is solved soon.

Could you share why you need to define it twice? What are you running into where you're using both?