-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESM build error on directory imports after upgrade to TS 5.0.0@beta #434
Comments
text > screenshotsPlease note that text is strongly preferred over screenshots when reporting GitHub issues (or StackOverflow questions, per the link), as text can be copied, searched, etc and is significantly more accessible, while screenshots cannot / are not nearly as accessible. As you used a screenshot, I did have to manually transpose the text of the error here: src/index.ts → dist/index.esm.mjs...
[!] (plugin rpt2) Error: src/index.ts:2:15 - error: TS2792: Cannot find module './logic'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option?
2 export * from './logic'; MJS usageBased on your code, this looks to be because of your usage of MJS, i.e. the ESM spec, along with how TS has changed up resolution in this space in recent times with Specifically, the 3 Per the Node ESM docs, directory imports must be fully specified:
So, as far as I can tell, this actually seems like a bug from when the MJS extension was specified back in react-hook-form/react-hook-form#7262, just that TS / Node just didn't error out on it before, whereas it has a stricter adherence to the spec now. TS 5.0 supportTS 5.0 is still in beta, so I think we'll want to wait for a stable release before supporting things that might change beforehand. In particular, rpt2 will probably have to update some code to support the new |
I apologise for that part, which I could have done better.
Thanks for the information above as well. |
You're welcome 👍 I suspect changing those 3 lines to the format of |
Troubleshooting
Does
tsc
have the same output? If so, please explain why this is incorrect behaviorIt's working correctly with
tsc
Does your Rollup plugin order match? If not, please elaborate
Rollup config hasn't been changed for years and looks like the order is not an issue:
https://github.com/react-hook-form/react-hook-form/blob/master/scripts/rollup/createRollupConfig.js#L14-L44
Can you create a minimal example that reproduces this behavior? Preferably, use this environment for your reproduction
Here is the PR: 🦶 upgrade to TS 5.0.0 react-hook-form/react-hook-form#9834
What happens and why it is incorrect
Related to
export *
Environment
Github action and local build
Versions
:rollup.config.js
:tsconfig.json
:package.json
The text was updated successfully, but these errors were encountered: