FredKSchott / create-snowpack-app

The all-in-one app template for Snowpack. [moved]
https://www.snowpack.dev
Other
727 stars 96 forks source link

plugin-dotenv doesn't work #172

Closed HassanAlgoz closed 4 years ago

HassanAlgoz commented 4 years ago
  1. I installed it with npm install --save-dev @snowpack/plugin-dotenv.
  2. Added the plugin in snowpack.config.json:
    "plugins": ["@snowpack/plugin-dotenv"]
  3. 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

ruslanchek commented 4 years ago

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_.

stramel commented 4 years ago

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.