solid-router: React is not defined
Describe the bug
When im trying to use Router it says
Uncaught ReferenceError: React is not defined
And nothing works after that error. It used to work like 1-2 weeks ago in my projects, but now its not working on newest projects.
App.tsx
import logo from './logo.svg';
import styles from './App.module.css';
function App() {
return (
<div class={styles.App}>
<header class={styles.header}>
<img src={logo} class={styles.logo} alt="logo" />
<p>
Edit <code>src/App.jsx</code> and save to reload.
</p>
<a
class={styles.link}
href="https://github.com/solidjs/solid"
target="_blank"
rel="noopener noreferrer"
>
Learn Solid
</a>
</header>
</div>
);
}
export default App;
index.tsx
import { render } from 'solid-js/web';
import './index.css';
import App from './App';
import {Router} from 'solid-app-router'
render(() => <Router>
<App />
</Router>, document.getElementById('root'));
its just default project but as soon as im adding Router it crashes
Your Example Website or App
1
Steps to Reproduce the Bug or Issue
Start new project then npm i solid-app-router
Expected behavior
1
Screenshots or Videos
No response
Platform
- OS: Windows
- Browser: Chrome
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 20 (2 by maintainers)
Commits related to this issue
- Add `jsx`, `tsx` extension to `optimizeDeps` for vite 3.1.2 — committed to solidjs/vite-plugin-solid by nksaraf 2 years ago
Sorry for the issue. We were too zealous trying to fix something in SolidStart… This should be fixed as is with vite-plugin-solid 2.3.6
Manage to find simple fixed. Tested other projects base on vite and guessing default settings.
i have downgraded to
vite@3.0.9andvite-plugin-solid@2.3.0+ switched solid-app-router to@solidjs/router@0.4.3Now it seems to work perfectly. Thanks everyone 😃