Strange React not defined error

I've created the bare minimum solidjs + vite app with just and index.html and index.jsx page:
import { render } from "solid-js/web";

export function App() {
return <h1>Hello</h1>;
}

render(() => <App/>, document.body);
import { render } from "solid-js/web";

export function App() {
return <h1>Hello</h1>;
}

render(() => <App/>, document.body);
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<script type="module" src="./index.jsx"></script>
</head>
<body>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<script type="module" src="./index.jsx"></script>
</head>
<body>
</body>
</html>
Yet I get this super weird error in the console for the line render(() => <App/>, document.body);: Uncaught ReferenceError: React is not defined
10 Replies
foolswisdom
foolswisdom2y ago
Can we see the vite config and tsconfig?
FjordWarden
FjordWardenOP2y ago
Vite is just this:
import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';

export default defineConfig({
plugins: [solidPlugin()],
});
import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';

export default defineConfig({
plugins: [solidPlugin()],
});
I dont have tsconfig ATM, does this matter?
foolswisdom
foolswisdom2y ago
Ah, you're doing plain javascript? Hmm
FjordWarden
FjordWardenOP2y ago
yes, well with jsx
foolswisdom
foolswisdom2y ago
I do believe we've had this issue with the js templates before Need to check the discord history / github issues
foolswisdom
foolswisdom2y ago
GitHub
templates/jsconfig.json at master · solidjs/templates
Vite + solid templates. Contribute to solidjs/templates development by creating an account on GitHub.
FjordWarden
FjordWardenOP2y ago
seems to have something to do with vite and the vite solid plugin
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
FjordWarden
FjordWardenOP2y ago
Yea I've upgraded and downgraded vite and solid in all sort of combinations, at the end I just used one of the solidjs template, don't know what was wrong with my setup but that is what js development is in 2023
Braveheart
Braveheart2y ago
how did you fix this its blocking our team using latest vite and solid and normal degit templates
Want results from more Discord servers?
Add your server