Skip to content

With a Vite project, it doesn't work as expected and throws process is not defined error #1

@soham901

Description

@soham901

I'm trying to use react-exe in a Vite project, but it fails with the following error:

process is not defined

Console Output

Image

Code i used

import { CodeExecutor } from "react-exe";

const code = `
export default function HelloWorld() {
  return (
    <div className="p-4 bg-blue-100 rounded">
      <h1 className="text-2xl font-bold">Hello World!</h1>
    </div>
  );
}
`;

function App() {
  return <CodeExecutor code={code} />;
}

export default App;

Expected Behavior

It should execute the provided code snippet without throwing any errors.

Actual Behavior

Instead, it crashes with the process is not defined error.

Additional Context

I noticed that the example provided in the documentation uses a client component in Next.js. Since process is not available in client components, I would expect the same error there. Could you clarify how it works in Next.js but fails in Vite?

Let me know if you need more details. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions