'Webpack loader configuration for esm.mjs files in react and typescript project

ERROR in ./node_modules/react-hook-form/dist/index.esm.mjs Module parse failed: Unexpected token (126:22) You may need an appropriate loader to handle this file type.

import { useForm, SubmitHandler } from "react-hook-form";

I am getting this error, when trying to use useForm from the React Hook Form package,

please help me out with solution



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source