-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
8.11.0 - Return outside of function #2980
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
I also noticed this today in a renovate PR upgrade of pg package. |
This can be changed in pg for everyone’s convenience, but that sounds like a bug in whatever tool isn’t recognizing a legitimate (and not infrequently used) feature of CommonJS modules. |
Just ran into this on an esm project that we were still using jest for. You have to jump through some hoops to get jest working with esm. Switching to vitest fixed it for us. |
Confirmed that pinning version v8.10.0 fixes the issue. For what it is worth, Next.js team is refusing to fix this (CC @shuding) calling this |
@lucgagan
When I set |
I just commented out the
and your project will automatically comment out the if clause whenever you and your colleague run check out for the further info: https://www.npmjs.com/package/patch-package |
We ran into the same issue but on 8.5.1 while this was not happening before. Looking for any practical explanation and solution to this |
Hm, I must admit, I haven't personally returned outside of a function in possibly ever. Is that really legitimate, or more of a convention that stuck around? The ECMAScript standard seems to consider that a mistake. |
Here is the build error when trying to use pg with Next.js:
I believe the average new user importing pg for the first time in some tutorial is going to struggle to know what is going on or how to work around. Could this be fixed? |
It looks like this was fixed in #3033, now waiting for a release 🎊 |
Sorry for the delay in releasing this! I got a new patch version up last night....should be good to go now. 😄 |
I'm having this issue. Is it fixed? |
@tiavina-mika Yes, it is fixed. See the comment above yours. |
Starting in version 8 a line was added to which a return happens outside of a function. I think this was added in 5532ca5 located in packages/pg/lib/crypto/utils.js. This recently popped up in our jest tests with an error of
SyntaxError: /node_modules/pg/lib/crypto/utils.js: 'return' outside of function. (7:2)
Reverting to 8.10.0 solves the problem for now
The text was updated successfully, but these errors were encountered: