-
-
Notifications
You must be signed in to change notification settings - Fork 533
[BUG] Getting 'TypeError: b is not a function' for production build #933
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
Comments
Are you able to create a minimal sample project with just the basic setup reproducing the problem? It could be a CodeSandbox or a git repo if that's easier. |
@gabrieljablonski here is a repo with the issue. it works if you use https://github.com/thomasbottonari/react-tooltip-error |
Thanks for taking the time. I'm honestly not sure what's causing this, but my first guess is some issue with the minifier. This is the code formatted using the devtools. Line 517 is the problem, in which But that shouldn't be the case, since you can see right above the declaration for
I haven't fully followed the call stack to make sure, but I'm quite sure the I'm positive this isn't a problem directly with If you're willing to investigate further, what I'd recommend you do next is try to use a different minifier engine (not sure how you'd do that, you can probably set it up somehow in the Next.js config). Another thing you could try is changing the sample project you built to call |
Thanks for looking into it. I'll probably just look for another tooltip solution, rather than invest more time in trying to get it to work. I'd rather not deviate from NextJS default configuration. |
Just a heads up, your example is using Next.js 13, we didn't test Next.js 13 with our library. I'm a fan of the Next.js project, but Next 13 still has a lot of bugs and we should wait more time for the next releases (this is only my opinion). The library is working fine with Next.js 12, also, you always can import React-Tooltip minified or not, the default one is minified but we export non-minified too as you can see here: https://github.com/ReactTooltip/react-tooltip#standalone |
It looks like Next.js switched their default minifier as of v13 (https://nextjs.org/docs/advanced-features/compiler#minification). If you set |
Good to know my diagnosis wasn't far off haha Thanks for reporting this, other people will probably run into it as well. |
I was able to resolve this issue by importing |
In case it helps others, I was able to implement an import redirect in next.config.js so that I don't accidentally import the wrong one in the future. Here is the code to do that.
With this in place you can just |
Upgrading to Next.js >= 13.3.0 also fixes this. For more info see #1001 |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
My tooltip is working just fine when running locally with my NextJS dev server. However my production build throws the following error:
When I remove the Tooltip element the error goes away. I attempted to get more information by turning off minification in my NextJS build, and that actually caused the error to go away entirely.
Version of Package
v5.7.3 (also tested with 5.7.2 and 5.6.0)
To Reproduce
Run a production build with minification (not sure if there is something specific to NextJS)
Expected behavior
No Errors, and the tooltip renders on the browser
The text was updated successfully, but these errors were encountered: