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

[Hydrogen] Vite dev server fails due to CJS error with react-compiler-runtime #2238

Open
thomasKn opened this issue Dec 1, 2024 · 0 comments

Comments

@thomasKn
Copy link

thomasKn commented Dec 1, 2024

Describe the bug

When bumping visual-editing to 2.10, I am encountering an error when trying to launch my Hydrogen app using the Vite development server. The server fails to start due to a CJS error related to the react-compiler-runtime dependency. The error message indicates that require is not defined.

I tried to add react-compiler-runtime to ssr.optimizeDeps.include but it doesn't fix the issue.

MiniOxygen encountered an error while running your app's entry point:

ReferenceError: require is not defined

To investigate the issue, examine this stack trace:
at (../../../../../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-compiler-runtime/dist/index.js?v=c402fdd6:16)
at (../../../../../../node_modules/.pnpm/@[email protected]_@[email protected][email protected]_react@18_gorjzvzh6ncycqqaccq7myh23u/node_modules/@sanity/visual-editing/dist/remix/index.js?v=c402fdd6:2)
at (../../../../../../app/root.tsx:8)

To Reproduce

Steps to reproduce the behavior:

  1. Clone the repository.
  2. Install dependencies using pnpm install.
  3. Start the Vite development server with pnpm run dev.
  4. Observe the error in the terminal.

Expected behavior

The Vite development server should start without errors, and the Hydrogen app should be accessible in the browser.

Which versions of Sanity are you using?

@sanity/cli (global)    3.65.1 (up to date)
@sanity/visual-editing  2.10.2 (up to date)

What operating system are you using?
macOS Sequoia 15.1.1

Which versions of Node.js / npm are you running?

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

No branches or pull requests

1 participant