Environment varaibles not being picked up during Rollup build

Hello there,

I’m trying to deploy a Svelte app. So it uses Rollup for the build. Locally, I have dotenv setup so during the build it replaces env. variables with values stocked in a .env file at the root of the project. Everything works great. So on the site config, I created a variable with the same name and value. But after the build, when I check the JS file, I can see the env. variable was replace with an empty string.

I’ve seen thread somehow related to this issue, but they were about calling those variables after the build. Here it’s really during the build that the issue occurs.

Here is a repo with the code I try to deploy. Any idea why it is not working?

Hi @Axiol, welcome to the community!

Have you read this post about how to use env vars in our buildbot: [Support Guide] Using environment variables on Netlify correctly?