question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Imports not works since version 2.8.4 or 2.8.3

See original GitHub issue

Describe the bug Hi, i have a NextJS application implemented with typescript that uses the yupResolver from this library. I have several deployments on Vercel and Heroku platforms that does not find the module.

Also, i have never imported successfuly using import { yupResolver } from '@hookform/resolvers/yup'; statement, by the way, for production deployments i have always used import { yupResolver } from '@hookform/resolvers/yup/dist/yup';.

Rollback and freezing the version for 2.8.3 has worked sucessfully, but as i can see, import the resolvers has always been shown to have issues.

I can not reproduce in a sandbox now, as it involves some proprietary code, but was kind hard to discover in my application that the issue involved the yupResolver by showing the following error

<html>
<body>
<!--StartFragment-->

Error occurred prerendering page "/cms/campaigns/new". Read more: https://nextjs.org/docs/messages/prerender-error
--
10:28:55.260 | ReferenceError: Cannot access '__WEBPACK_DEFAULT_EXPORT__' before initialization
10:28:55.260 | at Object.Z (/vercel/path0/.next/server/chunks/3705.js:3505:36)
10:28:55.260 | at NewCampaignProfile (/vercel/path0/.next/server/pages/cms/campaigns/new.js:37:165)
10:28:55.260 | at d (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:33:498)
10:28:55.261 | at bb (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:16)
10:28:55.261 | at a.b.render (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:42:43)
10:28:55.261 | at a.b.read (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
10:28:55.261 | at Object.exports.renderToString (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:52:138)
10:28:55.261 | at renderPage (/vercel/path0/node_modules/next/dist/server/render.js:723:46)
10:28:55.261 | at Object.ctx.renderPage (/vercel/path0/.next/server/pages/_document.js:71:30)
10:28:55.261 | at Object.defaultGetInitialProps (/vercel/path0/node_modules/next/dist/server/render.js:364:51)

<!--EndFragment-->
</body>
</html>

This similar error has been reproduced across many other modules, as those NextJS page has a built in a implementation of react hook form in a footer component. After that, i have been isolating a lot of code until get a error that crashed in production execution.

Some errors have mention that resolvers implementation were not available to be used with CommonJS implementation, so i recommend to check if those resolvers exports are correctly to be used by typescript code.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
evocateurcommented, Feb 8, 2022

I was able to build successfully on the latest version of Next (12.0.9 when I tried last week) and latest version of @hookform/resolvers. I suspect deeper issues are at play in this particular case.

1reaction
yangricardocommented, Jan 26, 2022

related issue: #271

That’s really similar. I have tried to put "preserveSymlinks": false in tsconfig.json without success. I think is some NextJS 12 module resolution mismatch. For now, i’m freezing this library at 2.8.3 version and importing @hookform/resolvers/yup/dist/yup

Read more comments on GitHub >

github_iconTop Results From Across the Web

unable to import sucrase since vite2.8 · Issue #7112 · vitejs/vite
I am closing this issue since it does not work with node and it is fixed on the library side (alangpierce/sucrase#684).
Read more >
Import "tensorflow.keras" could not be resolved after ...
The imports themselves seem to work at runtime, but because the import cannot be resolved I can't make use of code completion, visualizing ......
Read more >
Upgrading to 2.8.2 and 2.8.3 (and later) - MODX Documentation
If you use a custom manager theme, you may find the manager no longer works after the upgrade. A variety of error messages...
Read more >
Install — NetworkX 2.8.8 documentation
First, make sure you have the latest version of pip (the Python package manager) installed. If you do not, refer to the Pip...
Read more >
FAQ: What version of Python is used in ArcGIS? - Esri Support
Answer. The Python programming language has been used in each version since ArcGIS 9.0. It is incorporated into the setups of ArcGIS Desktop, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found