plugin-dotenv doesn't work
HassanAlgoz opened this issue · comments
Hassan Algoz commented
- I installed it with
npm install --save-dev @snowpack/plugin-dotenv
. - Added the plugin in
snowpack.config.json
:
"plugins": ["@snowpack/plugin-dotenv"]
- 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
Mike Burton commented
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_
.
Michael Stramel commented
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.