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

[vike-solid] ReferenceError: React is not defined #143

Closed
rtritto opened this issue Dec 18, 2024 · 6 comments
Closed

[vike-solid] ReferenceError: React is not defined #143

rtritto opened this issue Dec 18, 2024 · 6 comments
Labels
bug 💥 Something isn't working

Comments

@rtritto
Copy link
Contributor

rtritto commented Dec 18, 2024

Description

In vite.config.ts, use only vike plugin (vike/plugin) and not one of UI framework (vike-solid or vike-vue) plugin.

Expected

A correct error instead of ReferenceError: React is not defined

Repro (repo: template-vike-solid-daisyui-hono ~ branch: react-not-defined)

  • git clone https://github.com/templates-ecosystem/template-vike-solid-daisyui-hono.git
  • git checkout react-not-defined
  • cd template-vike-solid-daisyui-hono
  • yarn
  • yarn dev
  • go to http://localhost:3000
  VITE v5.4.11  ready
  ➜  Local:   http://localhost:3000/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
21:17:43 [vike][request(1)] HTTP request: /
21:17:43 [vike][request(1)] Following error was thrown by the onRenderHtml() hook defined at vike-solid/__internal/integration/onRenderHtml
ReferenceError: React is not defined
    at Page (C:\template-vike-solid-daisyui-hono\src\pages\index\+Page.tsx:2:3)
    at Dynamic (file:///C:/Users/<USER>/AppData/Local/Yarn/Berry/cache/solid-js-npm-1.9.3-16b4808c18-10c0.zip/node_modules/solid-js/web/dist/server.js:1148:34)
    at createComponent (file:///C:/Users/<USER>/AppData/Local/Yarn/Berry/cache/solid-js-npm-1.9.3-16b4808c18-10c0.zip/node_modules/solid-js/dist/server.js:367:15)
    at Page (file:///C:/template-vike-solid-daisyui-hono/.yarn/__virtual__/vike-solid-virtual-3aec55406e/4/Users/<USER>/AppData/Local/Yarn/Berry/cache/vike-solid-npm-0.7.7-9c8cfd63b0-10c0.zip/node_modules/vike-solid/dist/integration/onRenderHtml.js:68:10)
    at createComponent (file:///C:/Users/<USER>/AppData/Local/Yarn/Berry/cache/solid-js-npm-1.9.3-16b4808c18-10c0.zip/node_modules/solid-js/dist/server.js:367:15)
    at Object.get children [as children] (file:///C:/template-vike-solid-daisyui-hono/.yarn/__virtual__/vike-solid-virtual-3aec55406e/4/Users/<USER>/AppData/Local/Yarn/Berry/cache/vike-solid-npm-0.7.7-9c8cfd63b0-10c0.zip/node_modules/vike-solid/dist/integration/onRenderHtml.js:37:18)
    at renderWrappers (file:///C:/template-vike-solid-daisyui-hono/.yarn/__virtual__/vike-solid-virtual-3aec55406e/4/Users/<USER>/AppData/Local/Yarn/Berry/cache/vike-solid-npm-0.7.7-9c8cfd63b0-10c0.zip/node_modules/vike-solid/dist/integration/onRenderHtml.js:56:29)
    at Wrapper (file:///C:/template-vike-solid-daisyui-hono/.yarn/__virtual__/vike-solid-virtual-3aec55406e/4/Users/<USER>/AppData/Local/Yarn/Berry/cache/vike-solid-npm-0.7.7-9c8cfd63b0-10c0.zip/node_modules/vike-solid/dist/integration/onRenderHtml.js:64:10)
    at createComponent (file:///C:/Users/<USER>/AppData/Local/Yarn/Berry/cache/solid-js-npm-1.9.3-16b4808c18-10c0.zip/node_modules/solid-js/dist/server.js:367:15)
    at Object.get children [as children] (file:///C:/template-vike-solid-daisyui-hono/.yarn/__virtual__/vike-solid-virtual-3aec55406e/4/Users/<USER>/AppData/Local/Yarn/Berry/cache/vike-solid-npm-0.7.7-9c8cfd63b0-10c0.zip/node_modules/vike-solid/dist/integration/onRenderHtml.js:35:14)
21:17:43 [vike][request(1)] HTTP response / 500
@brillout brillout added the bug 💥 Something isn't working label Dec 19, 2024
@brillout
Copy link
Member

brillout commented Dec 19, 2024

Same here: up for digging into this?

@magne4000
Copy link
Member

@rtritto You forgot to add vike-solid/vite in vite.config.ts plugins.

@rtritto
Copy link
Contributor Author

rtritto commented Dec 19, 2024

@magne4000 was intentional (see Description).
The error message isn't correct.

@brillout
Copy link
Member

@rtritto Not sure how the error message can be improved. Contribution welcome to dig into this.

@rtritto
Copy link
Contributor Author

rtritto commented Dec 19, 2024

Shouldn't this issue remain open?

@magne4000
Copy link
Member

@rtritto I'm not considering this is an actual issue. If the message error can be improved, it probably would be on Vike's side, but I'm not sure this is possible currently.
Anyway, feel free to investigate into this if you want, but this doesn't require the issue to be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 💥 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants