I made a basic Node.js/React project, and my .env file doesn't work. My project is at https://github.com/TheGElCOgecko/weather-predictor/tree/main. The main details is that I am using dotenv-webpack, my .env file is in the root directory, the project is a React/Node.js project, whenever I try and print a value from the .env file, it prints "undefined" (I print it in App.js), and when I deployed it on GitHub Pages using "npm run deploy", it straight up deleted my .env file.
I tried using dotenv instead of dotenv-webpack, but that didn't work and it wouldn't compile if I included "require('dotenv').config();". My webpack.config.js used to include this:
resolve: {
fallback: {
"path": require.resolve("path-browserify"),
"os": require.resolve("os-browserify/browser"),
"crypto": require.resolve("crypto-browserify"),
}
},
I switched to dotenv-webpack because at least that was compiling (whereas using dotenv resulted in compilation failing), but maybe that was the wrong choice?