FredKSchott / create-snowpack-app

The all-in-one app template for Snowpack. [moved]

Home Page:https://www.snowpack.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

plugin-dotenv doesn't work

HassanAlgoz opened this issue · comments

  1. I installed it with npm install --save-dev @snowpack/plugin-dotenv.
  2. Added the plugin in snowpack.config.json:
"plugins": ["@snowpack/plugin-dotenv"]
  1. Added a .env file with key value pairs:
key1=val1
key2=val2

Yet I don't see anything added to import.meta.env. Am I missing something?

snowpack version: 2.6.4

Same here. I think the plugin has a lack of documentation. Trying to get it works.
UPD: It seems like public env vars need to be prefixed with SNOWPACK_PUBLIC_.

Correct, the environment variables need to be prefixed with SNOWPACK_PUBLIC_ to be used by Snowpack. This is to prevent accidental exposure of keys/secrets. I will update the README to include this note. Sorry for the confusion.