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

(ReferenceError: process is not defined) on Dev Server when using { json } "@remix-run/node" #9604

Open
ivoGanev opened this issue Jun 11, 2024 · 1 comment

Comments

@ivoGanev
Copy link

Reproduction

I couldn't find any related topics or bug reports about this issue.
I've got a very simple setup where I got the route subject.$subjectId.tsx looks like this

export default function LessonPage() {
    return (
        <>
            <LessonDisplay />
        </>
    )
}

and the component located at app/components/LessonDisplay.tsx

export async function loader() {
  return json({any: "thing"});
}

// export async function loader() {
//   return new Response(JSON.stringify({ any: "thing" }))
// }


export default function LessonDisplay() {
  return (
    <>
    </>
  );
}

On Dev server, if I access the page through the url I get
util.js:109 Uncaught ReferenceError: process is not defined
at node_modules/util/util.js (util.js:109:1)
at __require (chunk-QGSYD46Z.js?v=96f51caf:12:50)
at node_modules/stream-slice/index.js (index.js:2:12)
at __require (chunk-QGSYD46Z.js?v=96f51caf:12:50)
at node_modules/@remix-run/node/dist/upload/fileUploadHandler.js (fileUploadHandler.js:23:19)
at __require (chunk-QGSYD46Z.js?v=96f51caf:12:50)
at node_modules/@remix-run/node/dist/index.js (index.js:17:25)
at __require (chunk-QGSYD46Z.js?v=96f51caf:12:50)
at index.js:99:2

If I try to use Link component on that route, the root page just refreshes and it doesn't even let me visit the subject.$subjectId.tsx route.
I don't see this problem when using JSON.stringify. So for example this code just works fine.

//export async function loader() {
  //return json({any: "thing"});
//}

export async function loader() {
   return new Response(JSON.stringify({ any: "thing" }))
}


export default function LessonDisplay() {
  return (
    <>
    </>
  );
}

This happens only on dev. If I build and start it all works just fine

System Info

Windows 11, any browser, latest Remix

Used Package Manager

npm

Expected Behavior

I would not expect to get this error

Actual Behavior

See the reproduction notes

@MetaMmodern
Copy link

MetaMmodern commented Jul 21, 2024

I'm getting same thing, doesn't look like it breaks anything though in my case..
doing json return in an action which is not being called upon page load, I think that's why my case is not breaking

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

3 participants