Hello.
I have a very basic webpack setup with just typescript + react support. For now, I have
.env
app.tsx
webpack.config.js
The .env just contains GITHUB_URL=https://github.com/samayo
app.tsx is just a simple react "hello world" which outputs process.env.GITHUB_URL via console.log
webpack.config.js contains the require('dotenv').config() code
but, somehow the variable is null. Am I missing some configuration?
You'll likely want to use webpack's DefinePlugin instead of dotenv
Please add that in the readme so you can save another person from frustration. That should've been mentioned in the first place.
@samayo I know it's late but there's https://www.npmjs.com/package/dotenv-webpack that works smoothly with webpack. You can play with the configuration to enable features and it's pretty simple to use.