How do I setup the dotenv file in Node.js?

前端 未结 30 1160

I am trying to use the dotenv NPM package and it is not working for me. I have a file config/config.js with the following content:



        
30条回答
  •  旧巷少年郎
    2020-12-07 15:01

    Had the same problem. I used dotenv-webpack and need to define

    plugins: [
      new Dotenv()
    ]
    

    in both webpack production and webpack base files (I use webpack merge). If was not defined in both files then it did not work.

提交回复
热议问题