This issue is caused by the fact that Vite does not perform type checking by default for .jsx files. To enable type checking for .jsx files, you can add the following configuration to your vite.config.js file:
// vite.config.js
export default {
plugins: [
{
name: 'typescript',
// enable type checking for .jsx files
// you can also add other file extensions here
// such as .tsx, .ts, etc.
enableJsx: true,
},
],
};
This will enable type checking for .jsx files and you should now see import errors when you forget to import a component.