I have migrated react-scripts to 5.0.0 for our web client react app. Since then it is failing to load the web client in the browser failing due to an uncaught reference error coming from main.js under node_modules/dotenv/lib as shown below.
function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */ {
let dotenvPath = path.resolve(process.cwd(), '.env') ----------> **Failing Here**
let encoding /*: string */ = 'utf8'
let debug = false
if (options) {
if (options.path != null) {
dotenvPath = options.path
}
if (options.encoding != null) {
encoding = options.encoding
}
if (options.debug != null) {
debug = true
}
}
This is the call stack that is apparently showing that the problem is coming from web pack bootstrap...
main.js:78 Uncaught ReferenceError: process is not defined
at Object.config (main.js:78:1)
at Module../src/index.jsx (index.jsx:8:1)
at Module.options.factory (react refresh:6:1)
at __webpack_require__ (bootstrap:24:1)
at startup:7:1
at startup:7:1
can you please help me in resolving this?