You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently installed the v1.3.2 version in a next.js project. The compilaton failed with the following error message:
import { transformToNestObject } from 'react-hook-form';
^^^^^^
SyntaxError: Cannot use import statement outside a module
Which was in the file /node_modules/@hookform/resolvers/dist/yup.js:2
On inspection, I found that the built files has import statements. That means they'd need to be transpiled before using. I believe that it is not a good practice to transpile code from node_modules (especially if it is from a third party library).
I noticed in the source code that v1.3.1 and later tsconfig with had the following option: "module": "ESNext"
Whereas v1.3.0 has: "module": "commonjs"
Downgrading to v1.3.0 fixes the import issue. I suggest changing the tsconfig.json. In case it was intentional, I'd like to know the rationale behind it.
The text was updated successfully, but these errors were encountered:
I recently installed the
v1.3.2
version in a next.js project. The compilaton failed with the following error message:Which was in the file
/node_modules/@hookform/resolvers/dist/yup.js:2
On inspection, I found that the built files has
import
statements. That means they'd need to be transpiled before using. I believe that it is not a good practice to transpile code fromnode_modules
(especially if it is from a third party library).I noticed in the source code that
v1.3.1
and later tsconfig with had the following option:"module": "ESNext"
Whereas
v1.3.0
has:"module": "commonjs"
Downgrading to
v1.3.0
fixes the import issue. I suggest changing thetsconfig.json
. In case it was intentional, I'd like to know the rationale behind it.The text was updated successfully, but these errors were encountered: