My react app works locally, when I run npm start
it'll compile and run without any errors. But when I deploy to Azure web app using Github Actions it fails in the compile with the following error
Error: Uncaught [Error: useRoutes() may be used only in the context of a <Router> component.]
Is there something specific about Github actions I'm missing here? The node and npm version I'm using are the same locally and on Github.
App.tsx:
function App() {
return (
<div className="App bg-gray-100">
<Routes>
<Route path='/' element={<MyComponent />} />
</Routes>
</div>
);
}
Index.tsx:
root.render(
<Provider store={store}>
<BrowserRouter>
<App />
</BrowserRouter>
</Provider>
);
React version 18.2.0, react-router-dom on version 6.3.0, react-scripts on 5.0.1. Running npm run build
yields a successful compilation.