#Program not recognizing .env file
9 messages · Page 1 of 1 (latest)
- Before I import anything and try to use process.env
- The message it shows me
- After I import the specified message, it says the variable is unresolbed
Try to create next.config and then paste this with your variables
/** @type {import('next').NextConfig} */ <-- typescript
const nextConfig = {
env: {
YOUR_VARIABLE: process.env.YOUR_VARIABLE,
YOUR_VARIABLE_TWO: process.env.YOUR_VARIABLE_TWO,
},
};
module.exports = nextConfig;
is this code in the client? if so, you can't use env vars in the client without the NEXT_PUBLIC_ prefix