-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
Uncaught ReferenceError: exports is not defined #71
Comments
more detail... which version and etc... can you reproduce that in CSB? |
I'm afraid I cannot reproduce it as this is a large Rails app with TypeScript React and GraphQL. Could it be the way you export modules? I really lack JS packaging knowledge... my babel.config.js:
tsconfig.json
|
@batamire Hi 👋🏻 Does that error occur at build time ? Can you provide more informations please ? |
I'm running into that same runtime error (also using Rails + webpacker but no Typescript). I'm importing the yup resolver rather than the zod resolver, but it's the same error otherwise. My Babel config is identical to the one posted above, excluding only the Typescript preset line (since we don't use Typescript): Issue occurs when using the Adding this plugin to Babel fixes the issue and prevents the runtime error from being thrown: Unfortunately, adding that plugin also causes a different runtime errors to be thrown for me in some Rails-related JS code (code that is unrelated to react-hook-form), so that alone likely won't be your panacea. Still trying to figure out how to get around this since I'm not great with webpack. |
It builds without problems, the error is pasted from Chrome Devtools, happens on component mount...
Offending line:
@sfederowicz same thing happens with yup... |
Up for yup... |
Is this still an issue for everyone? (i couldn't reproduce) |
Yes. Can't update from 0.0.6 because of it. My most relevant dependencies: |
@studnik18 have you try to upgrade to the latest? and what build tool are you using? |
Yes, I tried just before posting :) Our setting is quite complicated - it's a monorepo with rails 6 and webpacker as ruby gems, on the frontend side it's |
Having the same issue, also using rails/webpacker. Downgrading to 0.1.1 did resolve. |
I was having the same issue, I tried to replicate it in codesandbox with no luck and after spending some more time it turned out to be a reference to the old way of importing the package: |
I had this lightbulb moment too :) But unfortunately that solution alone didn't help. Thanks anyway John. |
Getting this too for yup |
Thanks for reporting, I'm looking for a solution |
I am getting this too for yup on a non-rails project. I am only getting the error on production build and not in development build. Edit: after adding |
Hi all, the last version 1.3.1 should fix this issue, someone can confirm ? Thanks |
@jorisre 1.3.1 using snowpack on
|
@amankkg thank for your feedbacks. Could you provide a snowpack example please ? ℹ️ I'm working on resolvers v2 with a better module support |
@jorisre hmm on 1.3.0 it works properly here is my WIP https://github.com/amankkg/frontend-template |
@jorisre it is quite messy 😅 let me know if you need clear and stable reproduction repo |
My case is fixed with |
@amankkg I'm glad it solves your problem ! :) But Next.js's users have the same problem since 1.3.1 : #100 EDIT (2/1/2020): Same for Snowpack users For everyone which want to try the v2, you can install the
Feedbacks are really appreciated :) If some of you get some errors with modules, please reply here. |
I'm facing the same issue as #100 ,
Now, I can't deploy to vercel :( The versions I'm using are:
|
Also, I updated to "@hookform/resolvers": "1.3.2" and I get the same error... |
@MontoyaAndres try to use the latest beta version. |
@bluebill1049 Works great! Thank you so much! I was deploying normally to Vercel when that error appears surprisingly 🤔🤔🤔. |
not sure about that :( sounds like picking update the latest, but your package.json says another story. (pick up the latest patch) |
Very strange, I didn't update anything in my code about react-hook-form... Just appeared when the building was executing in Vercel :( |
This worked for me, thanx, when are you planning to release this version? |
@asotog At the same time of react-hook-form v7 @bluebill1049 Do we have a "deadline" ? |
No, we don't. It's open-source, we are all working on this in our free time. So no pressure, we get it right and we ship it out. I am planning to do a quick video to cover some of the major changes and improvements, then we can release a beta version and get more users to "test" this out. |
I had the same issue with 1.3.2 using snowpack. 2.0.0-beta.3 didn't work either. Although snowpack suggests this workaround that seems to be working for me: // doesn't work
import { yupResolver } from '@hookform/resolvers/yup';
// it works
import type { yupResolver } from '@hookform/resolvers/yup'; |
Another workaround that works with snowpack v3.0.11 would be: import hookforResolvers from '@hookform/resolvers/yup';
const yupResolver = hookforResolvers.yupResolver; |
@jorisre any idea on this one above? |
It seems to work for @tajdien, can you share a working example please ? @borivojevic I'm not familiar with Snowpack but if you have a reproductible example to provide then I can investigate thanks ! |
@jorisre I hope this example helps.
This is the implementation that's problematic. |
@borivojevic Happy to try Snowpack, esbuild is fast as expected 🚀 In your example you use the version 1.3.3 which have an issue with module exports (solved in v2). I added a note for Snowpack users : #71 (comment) Hope it helps |
Thanks @jorisre. I can confirm that v2 beta works on this smaller example as well. |
I was having this issue with yup and nextjs. After downgrading to 1.3.0, everything seems to be working OK. Thanks for the workaround @jorisre |
using "@hookform/resolvers": "2.0.0-beta.3" with "next": "10.0.7" seems to work perfectly! |
@hamzahasbi |
|
For me too !! :D |
|
I have the same problem: exports.__esModule = true; ReferenceError: exports is not defined |
|
👋🏻 |
1.3.9 seems to have the same issue again :( |
There is 2.8.0 released. Why would you bother with 1.3.9 ? |
thanks @studnik18 🙈 👍🏽 |
trying to:
gives me:
This is a Rails webpacker + typescript app.
The text was updated successfully, but these errors were encountered: