You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 10, 2021. It is now read-only.
If you absolutely need to use import.meta.env in the template and believe this to be a bug please add a proper reproduction and error logs that show when/how this is happening.
The error message is directly from the svelte compiler. If you absolutely need this to work, bring it up on svelte discord.
But i'd recommend declaring a const and use that.
Summary
Before Svite I was using
<div>{process.env.MY_ENV_FROM_FILE}</div>
.Now (because of this: https://github.com/vitejs/vite#modes-and-environment-variables) I have to use
import.meta.env.VITE_MY_ENV_FROM_FILE
and it works in JS code.But I need to use it also in my html sections, like this:
<div>{import.meta.env.VITE_MY_ENV_FROM_FILE}</div>
.But it doesn't work:
Cannot use 'import.meta' outside a module
.Proposed Solution
Use process ENVs also in template sections, please.
😄
The text was updated successfully, but these errors were encountered: