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"
I entered
node
and explicitly set theprocess.env.SALESFORCE_CALLBACK_URI_BASE
to a new value, but when I rannpm run dev
this value was overwritten.I explicitly installed
dotenv
package.My
.env
file is at the base of the project and I also created a second.env.local
with the correct values.I restarted my VSCode.
In
svelte.config.js
I addedenv
property.
const config = { preprocess: vitePreprocess(), kit: { env: { dir: '.', }, adapter: adapter() }};
- Deleted
.svelte-kit/
andnode_modules/.vite
and usednpm run dev
.
The above steps were done exclusive of each other and they did not work.