2 years ago
#74606
Gaurav kumar
React Application throwing "Uncaught SyntaxError: Unexpected identifier", after adding lazy loading at route level
Application is built with CRA and the following are the version details:
React: 16.13.1 React-Scripts: 3.4.1
Getting unexpected token error after deploying app in production. Error in prod : Uncaught SyntaxError: Unexpected identifier
lazy load Statement :
const Xyz = React.lazy(() =>
import("components/XYZ/container/Index")
);
Suspense:
<Suspense fallback={<div>Loading...</div>}>
<Router>
<Switch>
<Route
key={index}
exact={route.nested ? false : true}
path={route.path}
// component={route.component}
render={routeProps => <Xyz {...routerProps}/>
}
/>
</Switch>
</Router>
</Suspense>
reactjs
lazy-loading
0 Answers
Your Answer