I inherited a React Webpack app that I’m trying to recreate using Vite. I started with a bare Vite/React app and then slowly added the legacy code to it. The problem I’m having is that the source has this weird introduction of TypeScript features in .jsx
files – mainly import type
and typing of parameters. For example:
X [ERROR] Expected "from" but found "{"
src/components/index.jsx:36:12:
36 │ import type { IAppProps, IProtectedRouteProps } from './types';
│ ^
╵ from
X [ERROR] Expected "{" but found ":"
src/store/rootSaga.js:18:35:
18 │ export default function* rootSaga(): Generator<any, void, void> {
│ ^
╵ {
I tried removing the ‘type’ from the import statements, but there are hundreds of them. Then I got hung up on the more complex statements, like the second one above.
I’d like to avoid changing any code, if I can avoid it. The original code worked built and ran, in whatever environment it had, but I cannot figure out how to get the code working in this clean Vite environment.