Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-error-overlay@6.0.10 Error when hot update #12064

Open
gengfire opened this issue Feb 16, 2022 · 4 comments
Open

react-error-overlay@6.0.10 Error when hot update #12064

gengfire opened this issue Feb 16, 2022 · 4 comments

Comments

@gengfire
Copy link

Uncaught ReferenceError: process is not defined
at Object.4043 (:2:13168)
at r (:2:306599)
at Object.8048 (:2:9496)
at r (:2:306599)
at Object.8641 (:2:1379)
at r (:2:306599)
at :2:315627
at :2:324225
at :2:324229
at HTMLIFrameElement.e.onload (index.js:1:1)

1.npm install
2.npm run start
3.change some code

@cmdcolin
Copy link

I have seen this also, I have had to add a yarn module resolution to pin react-error-overlay to 6.0.9

seen here also https://stackoverflow.com/questions/70357360/process-is-not-defined-on-hot-reload/70402397

i'm currently on cra v4.0.3

@gamedevsam
Copy link

gamedevsam commented Mar 28, 2022

Wish react devs would realize their tools are used outside React projects (bundled with webpack-dev-server in my case) and I'm not running in an environment where process is defined.

Why not just create helper functions to deal with process? Ex:

"win32" === getProcessValue("platform")
"production" === getProcessEnvValue("NODE_ENV")

export function getProcessValue(key) {
    if (typeof process === "undefined") {
        return undefined;
    }
    return process[key];
}

export function getProcessEnvValue(key) {
    const env = getProcessValue("env");
    if (!env) {
        return undefined;
    }
    return env[key];
}

Please and thank you!

@darrengeary
Copy link

@gamedevsam Can you elaborate on what you mean by "tools are used outside React projects (bundled with webpack-dev-server in my case)"?

@gamedevsam
Copy link

I'm using a stack that consists of LWC components created with create-lwc-app. I don't use React anywhere there, but Webpack's HMR seems to bundle some react libs to provide debugging utilitites to non-react projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants