Search code examples
npmnpm-installnpm-scriptsnpm-publishnpm-package

Publishing an npm package


How to use .ENV variables when publishing npm package. Is there any way to publish my npm package in any way with .env-variable?

Thank you in advance!

And i am using this version: "dotenv": "^16.0.3" 

Solution

  • You are making a confused. The .env always will be created by the consumer of your lib. He will create a .env file and set the values. What you must is added the env variables in your documentation.

    By the way, the .env file usually doesn't commit to your repo. But you can commit a file template like .env.template to help other developers to use your lib.