Skip to content

Support import.meta.env.VITE_FOO in Vue templates #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks done
mahnunchik opened this issue Dec 21, 2022 · 2 comments
Open
4 tasks done

Support import.meta.env.VITE_FOO in Vue templates #66

mahnunchik opened this issue Dec 21, 2022 · 2 comments

Comments

@mahnunchik
Copy link

Description

Add support environment variables import.meta.env.VITE_FOO in Vue templates.

// text.vue
<template>
  <p>{{ import.meta.env.VITE_FOO }}</p>
  <div v-if="import.meta.env.VITE_FOO">
    content
  </div>
</template>

Currently the code above raises the error:

[plugin:vite:vue] Error parsing JavaScript expression: import.meta may appear only with 'sourceType: "module"' (1:1)

Suggested solution

Just support it 😉

Alternative

No response

Additional context

Related issues:

Validations

@sapphi-red sapphi-red transferred this issue from vitejs/vite Dec 21, 2022
@sapphi-red
Copy link
Member

@sapphi-red sapphi-red added the bug: upstream Bug in a dependency of this repository label Dec 21, 2022
@sapphi-red
Copy link
Member

vuejs/rfcs#566

@edison1105 edison1105 added enhancement New feature or request and removed bug: upstream Bug in a dependency of this repository enhancement: pending triage labels Sep 24, 2024
@sapphi-red sapphi-red removed the enhancement New feature or request label Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants