Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1816

New values not being loaded for .env for SvelteKit app

$
0
0

I am unable to get Sveltekit to read the latest values from .env.

Any help on where are these old values coming from?

I have tried the following ways:

1.

import { SALESFORCE_CLIENT_SECRET, SALESFORCE_CLIENT_ID, SALESFORCE_CALLBACK_URI_BASE } from '$env/static/private'import { env } from '$env/dynamic/private'console.log('meta.env.DEV-->', import.meta.env.DEV.valueOf());console.log('settings-static-->', SALESFORCE_CALLBACK_URI_BASE)console.log('settings-dynamic-->', env.SALESFORCE_CALLBACK_URI_BASE)console.log('settings-process.env->', process.env.SALESFORCE_CALLBACK_URI_BASE)

They all show the "old value"

  1. I entered node and explicitly set the process.env.SALESFORCE_CALLBACK_URI_BASE to a new value, but when I ran npm run dev this value was overwritten.

  2. I explicitly installed dotenv package.

  3. My .env file is at the base of the project and I also created a second .env.local with the correct values.

  4. I restarted my VSCode.

  5. In svelte.config.js I added env property.

const config = {    preprocess: vitePreprocess(),    kit: {        env: {            dir: '.',        },        adapter: adapter()    }};
  1. Deleted .svelte-kit/ and node_modules/.vite and used npm run dev.

The above steps were done exclusive of each other and they did not work.


Viewing all articles
Browse latest Browse all 1816

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>